When I have image stored in my bundle dir structure displaying image is easy with Assetic as from documentation:
{% image '@AcmeFooBundle/Resources/public/images/example.jpg'
filter='jpegoptim' output='/images/example.jpg'
%}
<img src="{{ asset_url }}" alt="Example"/>
{% endimage %}
but how can I use assetic for my uploaded images? below my getWebPath returns path relative to web dir for example: “/uploads/images/image.jpg”. Maybe this solution is ok and there is no need to use assetic? I think that using it for some filtering like above jpegoptim could be useful
<img src="{{app.request.basepath}}/{{ entity.getWebPath }}">
1 Answer