Random Image Rotator Working Again

Filed under: Uncategorized. Tags: ,

It’s the Week of Things Working Again. First the Flickr albums via FAlbum, and now the rotating banner image, via “Automatic Rotator.”

It’s a simple php script that you put in a directory of images, then every time it is called, it spits out a random image file from that directory. I modified my css file to point the background of the banner div to that script, so every page view automatically gets a random image. To add a new image to rotation, I just drop it in the directory.

Again, if you don’t feel like hitting command+R a couple dozen times to see them all, just hit the handy dandy Banner Image Lister – another simple script that dumps out all files in a directory (including the rotator.php, which will appear to duplicate one of the images at random, and the index.php file itself, which will appear as a broken image).

Thanks to Cole for some gentle nudging to get me to put this together, and thanks to Automatic Labs for putting Rotator together.

Comments

6 Responses to “Random Image Rotator Working Again”

  1. I gotta second the thanks for getting this script working. It is so much better than hacking up the WP files. Just a simple edit in CSS and wham, rotating headers. Thanks for pointing it out to me.

  2. D'Arcy says:

    Hey – no problem. I didn’t have to write any code, so I was pretty happy about it, too! A google search turned up the A List Apart article, which pointed me to the Automatic Labs page on the script. Works like a charm.

    I’ve noticed old browsers may cache the image – since the URL stays the same – so they won’t get the new-image-every-page-view thing, but whatever. If you’re still using a browser that can’t deal with it, at least you still get an image :-)

  3. Ryan Kelly says:

    Can you show us what you changed in the CSS file…

    I can’t get it to work, does the PHP parse css files for tags?

  4. Ryan Kelly says:

    It’s ok, i’ve managed to get it to work now.

    Also written a short ‘how to‘ if anyone else is interested….

  5. [...] Thanks to D’Arcy Norman, from whom I got the idea. // Used for showing and hiding user information in the comment form function ShowUtils() { document.getElementById(”authorinfo”).style.display = “”; document.getElementById(”showinfo”).style.display = “none”; document.getElementById(”hideinfo”).style.display = “”; } function HideUtils() { document.getElementById(”authorinfo”).style.display = “none”; document.getElementById(”showinfo”).style.display = “”; document.getElementById(”hideinfo”).style.display = “none”; } [...]

Leave a Reply