Ben Metcalfe

My blog friendly Flickr front-end PHP script

I’ve just started getting into Flickr – think online photo repository meets del.icio.us, with blog and XML functionality.

Anyway, it’s a nice system BUT the main method of viewing photos seems to be via a Flash App (it allows interactive commenting, etc). Those of you who don’t know me, I’m not a big fan of Macromedia Flash.

Despite my reservations about the presentation of images within Flickr, I like the way I can easily email my pictures from my P900 phone and get them automatically posted to my blog. SO, I’ve written my own interface that completely displays my photos outside of the flickr website – avoiding their implementation of Flash. Yes, it has removed the commenting and taxonomy tagging opportunities, but for the time being I’m happy.

Flickr already offers a basic “photo flickr-roll” for your blog, but it uses Javascript to call the roll on the client-side (end user), and inserts it via document.write. This technique is simple-yet-effective, indeed I implemented it when I built the BBC News Headlines Syndication Boxes, but it’s not ideal – especially if you have PHP/Perl/ASP available to you.

I took their Javascript offering and pulled it around into something better (I think).

You can see it in action on the Moblog section of this blog’s sidebar.

In a nut shell it works like this:

  1. Get’s the latest x number of thumbnails from Flickr
  2. Strips out their Javascript document.write implementation
  3. Produces new anchor tags that link to the full size photos, based on a string manipulation of the source-urls of the thumbnails. (rather than point you to a page with your image in their cruddy Flash app

If you like it, please feel free to take the code:

Download Flickr Code (save as a .php file)