Random banner images

Following Cole’s lead, I added my own version of randomized banner images. I get the urge to modify the layout every now and then, and this just might cure that for a while since it looks different every time I see the page…

There are currently 11 images in rotation. Many were tweaked a bit to make the text a bit more readable over top of the image. All images were taken by myself, and the location is labeled. Most are from around the Calgary area, but there are a handful from other locations as well.

If you don’t feel like hitting reload a dozen or so times to see all images randomly displayed, they’re all nicely listed here.

3 thoughts on “Random banner images”

  1. James, it looks like I did it the hard way… Cole Camplese just posted how he did his, and there’s apparently a plugin that does exactly this. I just rolled up my sleeves and wrote a couple of lines of PHP to do essentially the same thing.

    Cole’s solution is here: http://camplesegroup.com/blog/index.php?p=56

    Basically, you just write something (or use the plugin ;-) ) to randomize the value of the background image for the header div. I feed it an array of filenames, and it picks one at random and sticks it into the inline CSS in header.php

    I can share the code if you like. It’s probably not the most elegant solution, but I built it to not have to hit the filesystem to read an entire directory each time a page is loaded, so the array is hard-coded into the php file. The “list all” page hits the filesystem to display all appropriate images without my intervention, though…

Comments are closed.