Blog Master G

Word. And photos, too.

Blog Master G random header image

Random Photos

Wednesday, September 10th, 2003 · 3 Comments

For some reason, I’ve been really into revamping my sidebar lately.

The latest addition: Random photos now appear at the top of the sidebar throughout my site. Leveraging my existing random entries script and the thumbnail photos already in my photos section, I created a new table in my database and threw together the following PHP template, which you can also see in stand-alone version:

<?php
include(“CONNECT_TO_DATABASE”);
?>

<div id=”random_photos”>

<div class=”sidetitle”>
From <a href=”http://gabeanderson.com/photos/”>Photos</a>
</div>

<div class=”side”>
<p>
<?php
$sql = “SELECT URL, imgSrc
from photos
order by RAND() LIMIT 1″;
$result = mysql_query($sql);

while ($row = mysql_fetch_array($result)) {
printf(“<a href=\”%s\”>%s</a>”,
$row[“URL”],$row[“imgSrc”]);
}
?>
</p>
</div>

What do you think of this feature? Is it too much? Does it make the sidebar too cluttered? I really like it (at least I think I do). It makes the site a bit more interesting and personal.

Next up: I’ll throw more photos into the table. There are only 18 right now, which map to the number of photo albums to which I’m currently linking in my photos section. You’ll notice that clicking on each photo that appears in the random photo feature will take you to the corresponding album. So if I want more random photos and want to maintain consistency in linking to related albums, that means bringing more albums online.

Of course, the alternative would be simply to throw in a bunch of thumbnails and not necessarily worry about making every one link to an album.

Suggestions?

Tags: site features

3 responses so far ↓

  • 1 dan // Sep 10, 2003 at 11:24 am

    Great! The first thing I did on your blog was hit reload 18 times!!

  • 2 scott reynen // Sep 10, 2003 at 12:33 pm

    your abuse of lazyweb has insured that i will never read your weblog. congratulations.

  • 3 Dave Reed // Sep 10, 2003 at 10:44 pm

    It looks cool. But, I guess I’ll be the first to say it: the side bar feels a little too busy. Honestly, I’m not sure what to suggest.