Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Can't get width or height of .gif file

Started by tomtomd 9 years ago · 3 replies · 2369 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, 1 year ago
6 1486 1 year ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1146 2 years ago
Content & Markdown · by Jan L'Am, 2 years ago
4 1015 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 925 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1397 2 years ago