A Twitter-like Flickr

Dave Winer outlined his latest Twitter mashup today. It alerts the followers of his Twitter stream whenever he uploads a photograph from his iPhone to his stream on Flickr. A Twitter for pictures, as he exclaims.

His mashup demonstrates the power of simple APIs and data formats. It combines RSS 2.0, a specification he developed, with the Twitter API. I’ve recently done something similar, so I thought I’d provide some details on the process.

Configure Upload by Email

Upload by EmailFlickr allows you to upload by email. They provide you with a unique address, and any photos sent to that address will be published into your Flickr account.

This address should be added to your phone’s address book, as I’ve done with my BlackBerry Pearl. When you snap a picture using the phone’s camera, an option is available to send as email. Select Flickr from the address book, hit send, and the photo is on its way to the web.

Tag the Uploaded Photos

Tag PhotosFlickr also gives you the option of automatically applying tags to the photos you send as email. You can tag them however you desire, “mobilephone” or “iphone” for example. I’ve decided to use the machine tag “flickr:agent=email” to indicate the photos I upload via email.

Machine tags are simple way to facilitate machine processing of tag-based data. They are useful in a wide variety of contexts, and I really wish more services would implement support for them. Since I am using this tag as a filter for a photo feed, using a machine tag is a natural fit.

Machine TagsAlso, Flickr’s designers refined a nice user interface with regard to machine tags. They are hidden underneath an expandable view, so they don’t clutter up the space of normal tags. The effect can be seen on a recent photograph.

Generate the RSS Feed

A public photos feed can be generated based on certain criteria. In my case, I’ve chosen to generate a feed of just my photos tagged “flickr:agent=email” in RSS 2.0 format. In accordance with the documentation, the feed uses the following options:

id = 39636626@N00
tags = flickr:agent=email
format = rss_200

Process the Data

Once you’ve retrieved the RSS feed of photos, it can be parsed and processed by your application. Dave chose to send a Twitter message, complete with a link to the photo.

I’ve done something different, however. I translate the RSS feed into a JSON-formatted structure. This resource is fetched using an Ajax request and rendered as a widget on the main page of this site.

What you choose to do is entirely up to you. As a starting point, the PHP code I use is available in this file: flickr-rss-to-json.zip. It will certainly need modification to suit your purposes, but feel free to play around. Let me know in the comments what you create!

Comments

Lonna Hanson
says:
August 7, 2007 at 1:32 PM

Very interesting, Jared. I know I really enjoy your pictures on your Twitter site. I also enjoyed reading how you have done it for your BlackBerry Pearl phone.
Mom

Twitter Search
says:
May 26, 2009 at 7:07 PM

thats great that you are talking about the twitter api,a good example of searching with the twitter api is on twiogle.com because you can search on twitter and google at the same time.

Post a comment