views:

53

answers:

2

I already wrote a PHP script that allows users to upload images but I want to be able to allow my users to upload animated images. What do I need to add to my current code to allow animated images using PHP? A quick code example would help me out a lot.

+2  A: 

What do I need to add to my current code to allow animated images using PHP?

Nothing. Animated images are images all the same.


EDIT: If you are resizing your images using GD, you'll lose the animation, since GD can't handle it correctly.
If you have the ImageMagick plugin installed, you should use it instead of GD:

$thumb = new Imagick('myimage.gif');

$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('mythumb.gif');

$thumb->destroy(); 

See also: Resize animated gif file without destroying animation

NullUserException
my script excepts gif, png and jpeg but animated images dont work at all they display as a single image with no animation.
delimit
@delimit The animation is probably lost due to (incorrect) manipulation (eg: resizing).
NullUserException
@NullUserException I resize my images
delimit
A: 

If your script accepts gifs and pngs you should be all set.

Powertieke
my script excepts gif, png and jpeg but animated images dont work at all they display as a single image with no animation.
delimit
Is the image being processed in any way after the upload? (Think GD or imagemagick) --> NullUserException's answer is the way to go!
Powertieke