I run into this problem a lot when creating sites for artists all the time. I have a gazillion images to display and there is no way in hell I'm hard-coding them all into the html. Plus, when there are images that need to be added or deleted, you just deal with that in the directory and not the code. The solution is actually pretty simple :) The last example I added is how to use it with lightbox => a dir full of thumbs and a dir full of full sized images.
First off, I'm using this function called "glob". The glob() function returns an array of filenames or directories matching a specified pattern. This function returns an array of files/directories, or FALSE on failure. [man page on glob()]
Display Images From A Folder
Display Images With Image Name From A Folder
What if I'm using lightbox? Here is an example using thumbs and images ;)
foreach ($files as $file) {
ReplyDeleteecho $file . "\n"
}
;)