Hello,
I tried the kirby.com Cloudinary Plugin which seemed to work well but it’s look like when I use the crop()
method it keep the original URL and then resize so the image is distorted, flattened.
My use case is for making thumbnails (croped to the top) for project screenshots, and it’s open the original file when clicking.
Here my simplified snippet which looking for a files field with multiple images:
<?php
// Project screen thumbnail sizes
$thumb_width = 540;
$thumb_height = 350;
?>
<?php foreach ($page->gallery()->toFiles() as $thumb) : ?>
<img src="<?= $thumb->crop($thumb_width, $thumb_height, 'top')->url(); ?>"
srcset="<?= "{$thumb->crop($thumb_width * 2, $thumb_height * 2, 'top')->url()} 2x"; ?>"
width="<?= $thumb_width; ?>"
height="<?= $thumb_height; ?>"
alt=""
loading="lazy">
<?php endforeach; ?>
What’s missing here?
Thanks!