On my personal site I have a section for images that are selected at random from a directory on refresh. I'm currently using Random image script (RandIm) by Klemen Stirn (I can post code if necessary). It works fine, but these are large images, and I would like to give my users the ability to click on the image displayed on my homepage (which is already restrained in size by CSS) to reveal the full-size image in a pop-up window or Lightbox. That part isn't the issue for me, but rather getting the PHP code to display the random image as a filename, or regular img tag, so that I could then turn it into an image link.
I have looked online for a very long time (months), and the only solutions I find for random image selection either create errors I don't understand or only output the link to the php file instead of the actual image source.
So, I'm taking a shot here, on the chance that someone either has the perfect code right up their sleeve, or can point me to a solution that I just haven't found. I imagine that I need a function in the code that reads the filename of the chosen image source and outputs it, but I'm not sure how to do so. My knowledge of PHP is VERY amateurish, so I can manage understanding of a code's structure and how to implement certain things, but I can't construct my own code from scratch.
What I'm looking for is a PHP code that will:
1. allow me to display an image on my website, that is randomly selected from a directory on my server.
2. allow me to add to the files in the directory without having to list them on any kind of txt file
3. allow me to maintain mnemonic naming, as opposed to having to name the files 001, 002, etc.
4. allow the output to be sent to the browser in HTML as a fixed image source that I could display full-size in a new window without the code refreshing to a new image.
5. allow me to display the filename of the randomly chosen image as image alt/title tags.
So, it seems like a lot, and maybe even seems rather particular... but I don't imagine it being a very difficult request, or maybe even a completely unique one (I saw the recent post about wanting to use EXIF data, which is along the same vein).
I hope to find an answer, so that this doesn't just end up as one of those random forum entries someone finds by a Google search for the same problem that doesn't have a solution



