Farming Flickr

Earlier this week, Flickr made some changes to the way static URLs to images are constructed and introduced the idea of farms. For some time now, many of the API calls have been returning an extra farm attribute, but now we can finally see how this new information is used.

Static photo URLs previously took the form

http://static.flickr.com/{server-id}/{photo-id}_{photo-secret}.jpg

So long as you knew the server-id, the photo-id and the photo-secret, you could construct the URL to the photo on Flickr. Now, there's another parameter you need: the farm-id.

Photo URLs now look like this:

http://farm{farm-id}.static.flickr.com/{server-id}/{photo-id}_{photo-secret}.jpg

At the moment, all photos appear to be served from farm1, but that will undoubtedly change in the future.

According to Cal Henderson of Flickr, the use of the farm variant of the URL is technically optional—the old static form will continue to work, but for photos uploaded since the change there will be extra overhead incurred—a request to an old-style URL will cause a redirect to the correct farm-based URL to be issued.For all photos uploaded before this change, the old static URL will continue to work exactly as before with no redirect—redirection only happens for new photos.

If you are caching photo details so that you can build the URLs as needed, you now need to start storing the farm id along with the server, photo id and secret. For photo information you already have cached, you don't need to re-request it just to get the farm details. All photos already uploaded are guaranteed to be in farm1—it's only for new photos that you'll need to explicitly check the farm.

And just to see what those URLs look like in practice, here's Wellington.

Using the old form of the URL, he looks like this

http://static.flickr.com/70/160244291_bd2ff55b61.jpg

Wellington (by dopiaza)

which, as you can see, still works fine.

Using the new form of the URL, he looks like this

http://farm1.static.flickr.com/70/160244291_bd2ff55b61.jpg

Wellington (by dopiaza)

which is, of course, exactly the same photo—it's just the URL that has changed.

All of this has a few consequences for my Flickr Mashups book. As farms were only introduced as the book was going to print, no mention of them is made in the book itself. This isn't really much of a problem as the use of farm id in the photo URL is optional—the examples in the book should continue to work as expected. I will, however, write up some notes on farms and how to use them and post them up here in the next few weeks. I'll also include details of how to update the examples in the book to make use of farm ids.


TrackBack

TrackBack URL for this entry: http://www.dopiaza.org/mt/mt-tb.cgi/59

Comment on this entry

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?