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
2010-09-25 09:57:32
my script excepts gif, png and jpeg but animated images dont work at all they display as a single image with no animation.
delimit
2010-09-25 10:02:39
@delimit The animation is probably lost due to (incorrect) manipulation (eg: resizing).
NullUserException
2010-09-25 10:05:35
@NullUserException I resize my images
delimit
2010-09-25 10:06:56
my script excepts gif, png and jpeg but animated images dont work at all they display as a single image with no animation.
delimit
2010-09-25 10:00:48
Is the image being processed in any way after the upload? (Think GD or imagemagick) --> NullUserException's answer is the way to go!
Powertieke
2010-09-25 10:12:01