Forum Moderators: coopster

Message Too Old, No Replies

Using PHP to Grab Latest Image from a Directory

Is it possible?

         

wfernley

8:06 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to create a PHP script that will look to a directory containing a bunch of images. It will need to tell which of the images is the latest image and display that on a webpage. It will also need to check for the latest graphic every 30 seconds.

Is this possible? :S

Thanks in advance for your help!

Wes

nfs2

8:39 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



The only thing i can think of is, on uploading a picture, insert the info (file name, upload time etc) into a database. Then it'll be easy to see what was last uploaded.

wfernley

8:48 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That sounds like a good idea but it wont be possible for this situation. The images will be uploaded from a camera device. I won't be able to record any additional info into a database when the file is uploaded.

jatar_k

2:31 am on Mar 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



sospin through the dir and try
[php.net...]

wfernley

4:38 pm on Mar 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply!

I was able to create a script in javascript that grabs the files from a directory and the last one it grabs (being the latest) and display it as an image. I then added a javascript code that refreshes the page every 30 seconds.

Works good!

Thanks again for your help!

wes