I want to display an image from a folder, which all have names as the Unix timestamp of when they were uploaded. So, I thought that PHP could scan the directory they are uploaded in, and find every image. But I then realised with lots of images, this could take some time. The next idea I had was finding out the current timestamp, and then using a while loop display the latest then images to be uploaded (which would be the ten nearest the current time stamp). My question is, would the less than operator know that only the ten last images existed, or would it look for one less?
The other problem I thought off, is how can PHP actively search the directory, and then pass back both the current image, and work out which ten should be displayed?
I did think of having it find the first ten, by seeing if it returned anything at all, but this also seems liek a lot of work!
Which is going to be the most effective method of doing what I want, or is there another method that I can't seem to think of!