6
votes

Is there any way to check if an image URL returns an animated or not GIF?

I need to save image URLs and then show the images on my site, so I would like to allow GIF extension, but I need to avoid animated GIFs. Is it possible to detect that on the fly with out downloading the image?

2
@Yadheendran php and more specifically Codeigniter Framework - itsme

2 Answers

4
votes

Check out this comment to the documentation for function imagecreatefromgif (on php.net). You still need to first download the image file even if you are just going to link to it later.

1
votes

I think, ImageMagick really will be your best chance:

identify -format %n  posible_animation.gif

Please check the forum post How to identify animated image format for more information.