I'm using twig quite heavily in my own projects. One thing that's always a bit cumbersome by default though is working with images.
So lately I've been adding a PictureExtension that can output a rendered image template like so:
{{ picture(uuid, 'my_picture_size')|raw }}
(...or output the individual data values and recreate the template in a macro)
Wdyt about shipping something like this (or better) by default?
For me this sped up development quite a bit. :smile:
sounds legit to me. Maybe a feature for 4.10? I don't like the |raw though, I think an extension can tell whether it will "ship" safe HTML?
I think an extension can tell whether it will "ship" safe HTML?
Ah sure yes :smile: , I'm actually using this and forget about it. You can pass an option ['is_safe' => ['html']] to a function/filter, so that the call can become this:
{{ picture(uuid, 'my_picture_size') }}
See #1528
Most helpful comment
sounds legit to me. Maybe a feature for 4.10? I don't like the
|rawthough, I think an extension can tell whether it will "ship" safe HTML?