Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Can't get width or height of .gif file

Started by tomtomd 9 years ago · 3 replies · 2137 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, 10 months ago
6 925 10 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 739 1 year ago
Content & Markdown · by Jan L'Am, 2 years ago
4 661 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 586 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 960 2 years ago