Can't get width or height of .gif file

Hi,

I’m currently working on a theme, which uses the media[‘filename’].width and .height method to get these values. It is working fine with image files like .png .jpg .jpeg etc. However if I’m using a .gif file, I’m not able to retrieve the properties of the image.

page.media['file.gif'].width

This just returns nothing at all. Can someone of you guys please tell me what I’m missing here?

Perhaps this method works only on static image media type?

Maybe, but if so, could a developer please confirm this?

GIFs are treated as animated files and not images. This is because if they are treated as images in Grav, and you resize them or perform any actions, the animation is lost. This is actually a limitation of the PHP GD library.

1 Like