Recently, while developing a site, I ran into a need for the ability to select 4 random images from a folder and display them in a div container. I searched around and found several scripts that would pull single random images (I’ve used this simple script from Matt Mullenweg’s site several times, for example) but nothing that would randomize multiple images. As I often do when I run into a brick wall, I tweeted about my problem and received a response from James Paden of Xemion.com* offering to write the script for me for free! The kindness and generosity of people I have met through blogging and Twitter continually amazes me.
He based the multi-image script on this single random image script, and it works great! Since I had such a hard time finding one I thought (with James’ permission) that I would make it available here. It’s set up to call 4 images, but shouldn’t be too hard to tweak for the number you need.
Thanks again to James for helping me out!
*Xemion.com is a great resource for small business owners and managers to both find web designers and learn how to best hire and work with design firms.