A couple times a year, someone asks how I created the Flickr "badge" that appears on the right side of my blog front page. It's not using JavaScript (what overkill that'd be) or anything fancy. It's simply an include file built up by a Perl script from a cron job every 20 minutes.

Basically it uses the Flickr API to fetch a list of my most recent photos, grabs the thumbnails, caches them on disk, and then re-writes the include file.

It's pretty simple, really. Here is the code: flickr_badge.pl.

It's a highly modified and pruned version of someone else's script that I ran across years ago. I have since lost the attribution, so ping me if you know where it came from and I'll gladly give credit.

This code is free for the taking, as in Public Domain. Use it for whatever you want. Feel free to give me credit or not. It's really not rocket surgery.

Posted by jzawodn at December 04, 2007 11:43 AM

Reader Comments
# BillyG said:

Oh, on your front page...

on December 4, 2007 12:24 PM
# Jeremy Zawodny said:

Yeah, sorry. I've clarified that.

on December 4, 2007 12:25 PM
# Brian said:

Just curious as to why you feel JS would be overkill. I realize that it potentially cuts some audience, but I guess I didn't mind it much because it pushed some of the load onto the client, and I didn't have to set up a cron job or anything. :D

on December 4, 2007 01:22 PM
# Jeremy Zawodny said:

Because nothing about it is interactive. Why should I slow down the page load and force the browser to do more work than it needs to?

on December 4, 2007 01:42 PM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.