With LiipImagineBundle is it possible to use a filter in twig like this?
<img src="{{ url|imagine_filter('thumbnail', '200', '100') }}" />
It should generate an image based on thumbnail
filter:
liip_imagine:
filter_sets:
cache: ~
thumbnail:
quality: 90
filters:
thumbnail: { size: [XXX, YYY], mode: outbound }
where XXX
and YYY
are the filter parameters (width and height).
The solution does now have to be exactly the same, but it's important for me to be able to prepare a simple filters 'on the fly' without having to declare all of them in the config.
Yes, you can change options on the fly using runtimeConfig
{% set runtimeConfig = {"thumbnail": {"size": [50, 50] }} %}
<img src="{{ url | imagine_filter('my_filter_from_config_yml', runtimeConfig) }}" />