I’m loading images into a grid by creating a grid-item for each image of a page. This works pretty straightforwardly, here’s a reduced version of my snippet:
<div class="grid-12">
<?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
<div class="content-item">
<div class="image-container">
<img
class="content-image"
src="<?= $image->url() ?>"
>
</div>
</div>
<?php endforeach ?>
</div>
I’d like to add an additional class to images with a certain extension (.gif). Is that possible? I tried the following, but that got me nowhere so far:
<div class="grid-12">
<?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
<div class="content-item">
<div class="image-container">
<img
class="content-image <php if ($image-> extension('gif')) { > myClass <php }>"
src="<?= $image->url() ?>"
>
</div>
</div>
<?php endforeach ?>
</div>
Thanks for any and all help. Have a good Sunday.