I have a bunch of radar images (*.gif) stored on my server, it gets a new one every 6 min. A user goes onto my site and using a form selects a start time and an end time using drop down boxes. That info (YYYY, MM, DD, HH) gets passed into my PHP script for computing.
"SELECT path FROM images where time between 'startTime' and 'endTime' limit 25"
// path is were the images are stored, ie, $HOME/radar/09-22-2005 HH:MM:SS.gif
Now, what happens right now is it spits back all the path's to all the .gif files, limited to 25 or so. I can display the images in a table, or as links, or whatever,
GREAT! it works, now onto the next step... (and this is leading to the real question)
What I am TRYING to do is take those *.GIFs and animate them then output the animated GIF back to the user. For example, if you wanted to see all the radar activity for the month of September
In order to do this i am using the SYSTEM() command to run gifsicle to make the animated gif. Usage is like this:
% gifsicle --delay=40 --loop pic1.GIF pic2.GIF pic3.GIF >> anim.gif
Now, this is all well and good, EXCEPT, i am stuck on how to "read in" all the returned path's from my database and put them into the system command. I have tried using loops and all kinds of crazy stuff, but no luck so far.
I tried making a loop so that it does something like this:
system('gifsicle --delay=40 --loop' //start command
for($i=0; $i<$numofrows; $i++) //use loop to insert values (all the paths)
{
print $PathArray[$i];
}
echo " >> $HOME/radar/anim.gif" //finnish the command
So i guess my real question is: Is there anyway to take fields from a database and "pass them" into a command line using the SYSTEM() command?
Am i going about this a totally wrong way? Is there a much simpler solution to making animated gif's and returning that new .gif back to the user?
thanks!
-Josh