I was interested in displaying the number of comments and favorites for drawings that I had posted on flickr on my portfolio site, and after a bit of mucking about with the flickr API I was up and running.
This is my exact implementation from my portfolio, so to use this code verbatum you'll need an unordered list inside of a div with an id of "caption". I expect you'll want to change that to suite your own markup. You'll also need your own API key which you'll assign as flickr.key and change the value of flickr.photoURL to the path of your photos.
The init method make a call to flickr.callFlickr, which takes an object as its argument with two properties: method and cb. Method is the name of the flickr transaction you want to call, and cb is the callback function you intend to route the response through.
flickr.callFlickr will only execute if it finds an element with an id of "flickrImg". It will parse the photo id from the src attribute of the image and then make the transaction request via a script element it creates.
The flickr API will send its JSON response to the method we defined as our callback. The first callback is flickr.comments which checks to make sure we got comments back and populates a list item element with the data, taking plurality into account. It then calls flickr.callFlickr, this time with a request for favorites.
flickr.favorites does essesntially the same thing as flickr.comments - it makes sure there is a comment count, and then appends the data to the list item element.
After assigning your flickr image an id of "flickrImg", simply call flickr.init() from the window's load event or wherever you like.
My requirements were that this only need work on a gallery page with a single image. You, however, may need it to work on the front page of your blog with multiple images. A modification using class names instead of id so that multiple photos could be used is not too far a stretch from the current implimentation.
This code is issued under a Creative Commons license. You do not need my permission to use it, though I'm always interested in seeing where my code has ended up if you want to drop me a line.slayeroffice main