If I've got a bunch of image resources that I made using the GD library in php, or otherwise a bunch of frames, how can I combine these into an animated gif? I've got an array of images and a frames per second I'd like to add..
I can't use ImageMagick or FFMPEG, and I'd prefer to just use the GD library if possible.
Apparently "Support for creating GIF animations is also available.", but I can't seem to find the documentation on how to access this from within PHP?
Well searching on Google revealed GIFEncoder.class.php found at http://www.phpclasses.org/package/3163-PHP-Generate-GIF-animations-from-a-set-of-GIF-images.html
This link requires registration.
So i searched a little and it is included in phpvideotoolkit on code.google.com and can be downloaded at:
http://phpvideotoolkit.googlecode.com/svn-history/r6/trunk/phpvideotoolkit/adapters/ffmpeg-php/gifencoder/GIFEncoder.class.php
there is also a bugfixed version just change the file name to GIFEncoder.class.phpvideotoolkit.php in the above link.
I haven't tried it myself but maybe it can help you.
in the parent directory of the php file on code.google.com is also an example
best of luck
This cannot be done with GD but I found a great library for it. It is a bit complicated though, so here is a link to the library which makes animated gifs with php. It explains how to use it thoroughly. http://www.phpclasses.org/package/3163-PHP-Generate-GIF-animations-from-a-set-of-GIF-images.html
You can look at my example using this library:
Just select 2 pictures and write 100 for speed 900 for width and height. It will put them in an animated gif slideshow.
Here is the code for that script:
As you see it references the GIFEncoder class found on the first link. It also uses some javascript validation and jQuery multiupload.
BTW this question was already asked.
AFAIK gd lib that is bundled with PHP doesn't support creating animated GIFs. You could use gifsicle though.