Sep
12
Filed under: Meta, Photolog | September 12th, 2004

Random Photo Returns

The random photos are back. I wrote a quick hack to loop over every photo in every album and read its relevant info into a MySQL table. Now instead of taking a few seconds to get a random photo using the Gallery data stores, it uses a single query and takes a millisecond. Long-time visitors to the site remember that the random image in the corner has always been one of my favorite things about this site, but as the photolog grew to a thousand, two thousand, and then nine thousand images it slowed down more and more. I had to start caching it so it would change once every 15 seconds, then every minute, then every 5 minutes, and then I just manually rotated it for a while. Finally I put the random image out of its misery.

Now it’s fully dynamic, every page you view is completely unique, just like you.

(There goes my bandwidth.)

Possibly related posts:

  1. Random Redirect Plugin I just updated theĀ  Random Redirect plugin, with two extra...
  2. Typekit Web Fonts Introducing Typekit, an iTunes-for-fonts on the web that allows you...
  3. Funnel Cloud Photo One of my sister’s photos was on Digg, randomly. ¶...
  4. Intensely Automattic Change.gov Everyone is honored and excited today that Change.gov, the website...
  5. Cuil I like Cuil. There’s just something very intuitive about the...

24 Responses

  • Dale | September 12th, 2004 @ 7:12 am | Reply

    hehehehe F5 F5 F5…..

  • MaThIbUs | September 12th, 2004 @ 7:23 am | Reply

    There goes my bandwidth.

    Indeed! Nine thousand photos is a whole lot, I can imagine those take up a lot of server space. (Poor me, I’ve only got 75 MB on my server, with a bandwidth limit of 5 GB…)

  • Observer | September 12th, 2004 @ 7:24 am | Reply

    @Dale:Hehe, nice one!
    @Matt: Another big PRO for RSS et. al., don’t you think?

  • Scott | September 12th, 2004 @ 7:33 am | Reply

    Awesome Matt! Bandwidth, Smandwidth!

  • markku | September 12th, 2004 @ 10:23 am | Reply

    Nine thousand photos? Wow. Maybe you should have your randomizer provide a unique photo when a visitor comes back, without serving a photo twice. Until all 9000 photos are delivered for that visitor. Then another shuffle, and the same cycle all over again…

    Just another stupid idea. ;)

  • Indranil | September 12th, 2004 @ 10:53 am | Reply

    Hey Matt, ever heard of “limited bandwidth”!!

  • Rob Mientjes | September 12th, 2004 @ 11:28 am | Reply

    Hurrah! I love the random image, and I missed it since it went out of rotation (well duh). Thanks for putting it up again.

  • Randy Peterman | September 12th, 2004 @ 1:43 pm | Reply

    Remember, you’re unique, just like everyone else.

  • Jonathan Stanley | September 12th, 2004 @ 1:52 pm | Reply

    Thought bandwidth was a commodity which one doesn’t have to worry about anymore? ;)

    Anyhoo… good to see it back as I’m using Gallery’s native “Random Block” feature on a friend’s site since June-ish, and finally gave in and started using it on my own blog just a couple weeks ago.

    F5 F5 F5 F5 F5 :D

    /me feels dirty in misusing <code> when he should have used <kbd>…

  • Daniel | September 12th, 2004 @ 2:53 pm | Reply

    I must say, 9,000 images is alot. It’s very good to see the random images up again. I did miss that space up there in the corner. Yay for photos!

  • Jesus Vargas | September 12th, 2004 @ 3:09 pm | Reply

    And the code? Is it free? LOL. ThX

  • Matthew Wilcox | September 12th, 2004 @ 3:50 pm | Reply

    Wow, so there -is- a reason you’re URL is photomatt.net
    Always wondered why the ‘photo’ bit

  • Matt | September 12th, 2004 @ 3:52 pm | Reply

    Reload to your heart’s content, that is what it’s there for. I use a lot of bandwidth, but it’s still a fraction of what’s available. Besides, what is the point of bandwidth if you don’t enjoy it?

  • Josh Street | September 12th, 2004 @ 5:06 pm | Reply

    Wow. That’s a bit kah-razy… I want that kinda bandwidth to throw around!! ;)

    Very cool.

  • Jeremy | September 12th, 2004 @ 6:03 pm | Reply

    yay! It’s back! :D

    Thanks Matt! I enjoyed this feature as well.

  • Matt Read | September 12th, 2004 @ 6:13 pm | Reply

    Looks very good Matt. And being on dial-up there nice and small and don’t add much to load time. Nice.

  • elissa | September 12th, 2004 @ 7:32 pm | Reply

    rockin’.

  • Stephan Segraves | September 13th, 2004 @ 9:04 am | Reply

    Very cool. Glad to see it back!

    Are you dynamically thumbnailing the photos before they are displayed?

  • Matt | September 13th, 2004 @ 9:10 am | Reply

    Nope the thumbnails are generated when I upload the picture.

  • Julie | September 13th, 2004 @ 1:09 pm | Reply

    Ah, the random photo. Beautiful. :)

  • Christine | September 13th, 2004 @ 9:39 pm | Reply

    Yeah!!! I’ve missed the random photos. It’s really strange to load up your site and see myself there though!

  • Carla | November 3rd, 2004 @ 5:40 pm | Reply

    Does it ignore Gallery-hidden images and albums, per chance?

  • Matt | November 3rd, 2004 @ 6:49 pm | Reply

    Yes it does.

  • Carla | November 7th, 2004 @ 2:54 pm | Reply

    Groovy. Tunes. Thanks, Matt! I use Gallery to organize as well as to present, and I don’t think anyone wants to be bombarded with random clip art or blobs. :D

Share your thoughts