Hello! I’m driving myself crazy trying to solve this issue so hoping someone might be able to help.
I have a simple portfolio site and am using srcset for responsive images. My site will also have animated GIFs so I want to use Imagemagick as the driver.
The big issue is that my images are not being resized by Imagemagick based on the srcset widths set in my project.php file:
<?php foreach($page->files()->sortBy('sort', 'asc')->not($page->files()->template('cover')) as $file): ?> <?php if($file->type() == 'image'): ?> <li> <picture> <img src="<?= $file->url() ?>" srcset="<?= $file->srcset([375, 640, 1440]) ?>"> </picture> </li> <?php endif ?> <?php endforeach ?>
They are all being displayed at the full-width of the original image. Folders are generated for each page image within the media folder, however each folder is empty.
I’m working with kirby v220.127.116.11 and building on a local mac environment (MAMP v6, PHP v7.4.16). I have enabled Imagemagick within php.ini and have confirmed the php being used looks correct by running:
<?php phpinfo(); ?>
I’ve also tried setting the convert location to the correct path per my MAMP installation (currently /Applications/MAMP/Library/bin).
If I switch back to the default GD driver within the config.php file, the images are displayed correctly based on the srcset widths. However, the animated GIFs stop working (and only show as static images of the 1st frame).
My config.php file is:
return [ 'debug' => true, 'thumbs' => [ 'bin' => '/Applications/MAMP/Library/bin', 'driver' => 'im', 'srcsets' => [ 'default' => [ '375w' => ['width' => 375], '640w' => ['width' => 640], '1440w' => ['width' => 1440] ] ] ] ];
Thanks very much in advance!