Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Can't get width or height of .gif file

Started by tomtomd 9 years ago · 3 replies · 2309 views
9 years ago

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.

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

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

9 years ago

Perhaps this method works only on static image media type?

9 years ago

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

9 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 12 months ago
6 1289 12 months ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1016 1 year ago
Content & Markdown · by Jan L'Am, 2 years ago
4 890 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 816 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1233 2 years ago