Symfony 2.7: resource component not working with imag_filter

With the introduction of the component component in Symfony 2.7, how can I output the relative URL of an asset without a version number?

I am using the following code that no longer works:

<img src="{{ asset('images/user.png') | imagine_filter('default') }}" alt="Image de profil" class="img-circle whitebg"> 

The object function displays the URL with the version number, and this is not correctly described in the imag_filter file:

http://mywebsite.com/media/cache/resolve/default/images/user.png%3Fversion=v1.0

My configuration:

 framework: assets: version: 'v1.0' version_format: '%%s?version=%%s' base_path: ~ packages: images: base_path: /images version_format: '' 

Ideally, I can do the โ€œImagineโ€ movie while maintaining this version strategy. Otherwise, deactivating the version for images can be good enough

Thank you for your help!

+7
filter symfony assets liipimaginebundle
source share
2 answers

To apply the filter to the relative path directly, asset() can be considered as a kind of helper:

 <img src="{{ asset('user.png'|imagine_filter('default')) }}"> 

You can also set the version (4th parameter) to false:

 <img src="{{ asset('user.png'|imagine_filter('default'), null, false, false) }}"> 
+6
source share

You must explicitly specify the package that you want to use for a particular resource:

 <img src="{{ asset('user.png', 'images') | imagine_filter('default') }}" alt="Image de profil" class="img-circle whitebg"> 
0
source share

All Articles