Grabbing last file...
| From: | Ashley M. Kirchner | Date: | Tue, 06 Jul 2004 06:10:43 +0000 |
| Subject: | Grabbing last file... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-189763@lists.php.net to get a copy of this message | ||
I have a capture script that runs every 2 minutes and dumps an image into a folder. I'm trying to write a script (which will get included in another) that will grab the last image in the folder and pass it on.
The images are saved as 'capture.####.jpg' where #### is the timestamp of the capture , starting at midnight, or 0000, and going till 2358. The structure of the folder is as follows:
/capture/.year/month/day/capture.####.jpg
An image captured today, at 4:28 pm, the full path/file would be:
/capture/.2004/07/06/capture.1628.jpg
(yes, there's a dot before the year)
So the script will have to automatically figure out the year/month/day (which I think is easy enough with a simply date function) but then will have to figure out which is the latest capture saved that it can then grab (note, I can not rely on using a date/time function because the server time may not be exactly the same as the last file saved.)
And all it has to do is figure out the last file, generate an <img...> tag and return it. Voila.
--
W | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> .
303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303,
U.S.A.