With the introduction of the asset 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 whcih does not work anymore :
<img src="{{ asset('images/user.png') | imagine_filter('default') }}" alt="Image de profil" class="img-circle whitebg">
The asset function outputs an url with a version number and this is not handled properly by the imagine_filter :
http://mywebsite.com/media/cache/resolve/default/images/user.png%3Fversion=v1.0
My config :
framework:
assets:
version: 'v1.0'
version_format: '%%s?version=%%s'
base_path: ~
packages:
images:
base_path: /images
version_format: ''
Ideally I would be able to make the imagine filter work while keeping this versionning strategy Otherwise, deactivating the versioning for images could be good enough
Thanks for your help !
Apply the filter to the relative path directly, asset()
can be seen as a sort of helper:
<img src="{{ asset('user.png'|imagine_filter('default')) }}">
You can also sett the version (4th parameter) to false:
<img src="{{ asset('user.png'|imagine_filter('default'), null, false, false) }}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With