Just copy the above to a text editor (such as notepad on Windows) and save as index.php. Now open FTP, create a new directory to put this file on your server so that you can access it through the web. Change directory, and upload the index.php you just saved, along with a bunch of gif and/or jpeg images. This script will take all gif/jpeg images in that directory and choose one randomly. It also works with hotlinking on and you don't need to add http://www.lunarforums.com/ to the hotlinking list.
This script's just for fun . Once I get the chance, I might do a script that'll resize stuff. Enjoy!
Hey Ripta, thanks for writing the script and I actually switched over to using it instead. It has a lot of benefits over the cgi one and this is why I am going to recommend it to people:
1) You can simply place the files in the folder that the index.php script is located in, and you don't have to worry about misspelling the file names, which causes the images not to display sometimes. Also, any new images simply need to be uploaded and they are automatically available to display; the cgi script required them to be manually typed.
2) Due to it being an index file, you only have to put the folder name for the link (so mine is http://bestgarden.net/Avatar/
for the link)
3) It doesn't have to be in the cgi-bin, so greater flexibility for the script.
3) Heck, it's php and that is so much cooler than cgi/perl anyway.
So, thanks again and hopefully the occasional red x issues with my pics will now disappear forever.
Have a Blessed Day