Blocking animated gifs.

Soldato
Joined
24 May 2006
Posts
3,824
Location
Surrey - UK
Hi again peeps,

Wondering if anyone knows how to check the metadata of a gif to see if it is animated.

PHP can do this using JPGs and i know it can be done with GIFs to, but there's naff all around the web showing how its done, i tried googling and ended up with hundreds of 'use php to create animated gifs' and the like in the results.

I've already set my browser to run animated gifs once (firefox - about:config allows this), but i'd like to do on a website for the sake of users at a later date.

It's a personal pet hate, and for now i had been adblocking but i'd like to add this function to a website.

Does anyone know of a script to do so?.....

It's defiantely possible, quite a few CMSs and Forums allow this option, i just need to know either how they do it or how it can be archived.

Any ideas?
 
well blocking user uploaded files would be a trivial matter. for example if you allowed signature/avatar uploads on a forum, you could simply convert the file.....

PHP:
$im = imagecreatefromgif($tmp_file);
header('Content-type: image/jpeg');
imagejpeg($im, '/path/to/saved/file.jpg');
imagedestroy($im);

or just disallow gif uploads altogther. :)

i hope you're not thinking of trying to block files on remote servers as that would be silly. you'd have no way of checking other than trying to load them all. :p
 
Just something to consider later down the road, don't want users uploading annoying flashing images for avatars and the like.

Animated gif = block
Flash animation = usually block to

I don't like media that distracts from content. I'm sure there's many that disagree and like animation, and it's not i dislike animation, it's the misuse of it.

Thanks for the suggestion, i think the better option would be to do the conversion as oppose to simply blocking gifs.
 
Back
Top Bottom