how to use liipimaginebundle filterset in twig -
i have following filterset in config file , problem using different filter in twig
liip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } relative_resize: { scale: 0.5 } # transforms 50x40 125x100 relative_resize: { scale: 1.5 } # transforms 50x40 125x100 crop: { start: [10, 20], size: [120, 90] }
if there 1 filter this,
<img src="{{ asset(['images/', news.picpath]|join| imagine_filter('my_thumb')) }}" alt="{{ news.title }} image not found" class="large" />
but not know how use it.
in config hane 1 filter set named my_thumb. if want more filters should separate them in config this:
iip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } my_half_scale_resizer: quality: 80 filters: relative_resize: { scale: 0.5 } # transforms 50x40 125x100 my_cropped_image: quality: 70 filters: crop: { start: [10, 20], size: [120, 90] }
and in twig file can use:
<img src="{{ asset(imagepath| imagine_filter('thumb_50x50')) }}"> <img src="{{ asset(imagepath| imagine_filter('my_half_scale_resizer')) }}"> <img src="{{ asset(imagepath| imagine_filter('my_cropped_image')) }}">
Comments
Post a Comment