mindkomm / timmy

Advanced image handling for Timber.
MIT License
171 stars 13 forks source link

feat: Add img_class argument for get_timber_picture_responsive() #84

Closed gchtr closed 1 month ago

gchtr commented 1 month ago

Ticket:

This pull request adds an img_class argument for the get_timber_image_responsive() function. It will add a CSS class for the fallback <img>.

PHP


<picture>
    <?php echo get_timber_picture_responsive( get_post_thumbnail_id(), 'custom-6', [
        'img_class' => 'the-class',
    ] ); ?>
</picture>

Twig

<picture>
    {{ post.thumbnail|get_timber_picture_responsive('custom-6', {
        img_class: 'the-class',
    }) }}
</picture>