V-labs / VlabsMediaBundle

Form, database and filesystem abstraction for files
44 stars 18 forks source link

Calling a filter from a controller #31

Closed jcrombez closed 10 years ago

jcrombez commented 10 years ago

I need to crop an avatar in my controller in order to give a resized avatar in a json response of a REST API.

I tried calling the twig filter but it's not public.

Is there a way to achieve that ? Is there a reason for the twig extension service not to be public ?

choomz commented 10 years ago

Hi,

The twig service is private because you should only access the twig environnement into a twig template.

If you want to crop, you can call your wanted filter service. Note the service declaration : https://github.com/V-labs/VlabsMediaBundle/blob/master/Resources/config/services.xml#L43-L48