Gif's not playing

Hey - I want to show gifs with Kirby, but they are not playing. It just shows the first frame.

This is my code:

$images = $subpage->gallery()->toFiles();
foreach($images as $image): ?>
  <img src="<?= $image->crop(300, 300)->url() ?>" alt="" >
<?php endforeach ?>

How can I play gif’s with Kirby?

Did you try to not use “crop”?

For my understanding this produces ONE picture, not some pictures in a gif-file.

You can use a CSS-file, if you need a lower size in the rendered page.

They are playing without the resize attribute. But I have several other pictures that need to be resized.

You could check the file mime-type and only resize non-gif images.

1 Like

Yes, that’d be one solution.

I have another question regarding resizing.
In some images, the color changes to either really saturated or desaturated. But thats only in the resized images the case. Is there any solution?

Resized (left) Original (right)

When you resize them, the original color information is stripped.

To prevent this, you can use the ImageMagick library in conjunction with a custom driver that does not strip color profiles.

Alright. I’ve changed the engine to imageMagick, but it doesn’t do anything.

Like this

return [
  'thumbs' => [
    'driver' => 'im'

Do I have to install something?

Edit: It changes the img’s url to something like 200x-q50.jpg, but the image is still in the original size.

Well, if you change to ImageMagick without having it installed, then nothing will happen to the images. So make sure that IM is available. You might have to provide the path to the convert binary in config as well.

Secondly, just changing to IM won’t help either, because the default IM driver strips the image information. That’s why I said you need a custom driver.