Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

Can't get width or height of .gif file

Started by tomtomd 9 years ago · 3 replies · 1742 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, 8 months ago
6 94 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 184 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 146 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 60 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 254 1 year ago