Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting animated GIF on the fly using PHP/CodeIgniter

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?

like image 524
itsme Avatar asked Dec 10 '12 10:12

itsme


2 Answers

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.

like image 70
Dani P. Avatar answered Oct 04 '22 23:10

Dani P.


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.

like image 41
Raja Avatar answered Oct 04 '22 22:10

Raja