I've got a directory that serves as an archive for PNGs, of which a new one is added every 6 hours. I'd like to make an animate gif that uses uses each of these images as a frame, and gets updated whenever a new image is added. I'm pretty sure I can handle all the file scrounging, but I can't figure out how GD is used to create animated gifs. Any help?
converting directory of PNGs to animated gif?
I havent done this wiht GD(I dont know if its even possible to do with GD) but with imagemagick its quite trivial. Heres a little tutorial that I found to create animgif with imagemagick:
http://www.linux.com/articles/46124
It looks like your example uses command line unix. I don't (afaik) have access to the command line; I'm on a shared server hosting plan. I suppose in theory I could use the CGI bins, but really, I'm not a programmer; I just know the PHP basics.
I asked about GD because its bundled into the PHP version my server runs, and is what I've been using to generate the PNGs. I'm not sure the Imagick extensions on my sites (shared) server are turned on, and the documention I can find for Imagick is a bit sketchy & over my head. But its nice to see its (in theory) available!
As an alternative, I may end up doing a slideshow with JavaScript that would look like an animated gif, but uses the individual PNGs. That would consume (a lot) more bandwidth- not a problem for my server, but for users maybe it is. On the upside, it offers the advantage of letting people control the animation with something like a slider bar.
Well usually theres some commands that you can use with exec functions. Imagemagick is usually installed in shared servers also but you never know..
Check with your host and ask/see if they have ImageMagick support. If they do, they should provide you with an example method of accessing it (e.g. either a PECL extension or an exec() path). Just because you don't have access to the CLI doesn't mean that PHP can't access it as well. :p
I read your message in a hurry and missed that you could use javascript also. By all means use javascript to change the pics and dont mind about users bandwidth in todays world with cable/dsl connections(ofcourse you can mind a LITTLE but you know what I mean ).
I have used Smoothgallery to create crossfading banners to some of the sites I made and I think you should give it a go. And actually it doesnt consume so much bandwidth because it loads the pictures in the background so if someone leaves the page earlier, he/she will not load all the pictures at once(as you would do with animgif).