If you've spent
much time on Flickr, you've undoubtedly noticed that some members, for reasons known only to themselves, turn off the
option to display the "All Sizes" button above their pics. This can be frustrating when you want to get a
closer look a a good shot, especially when the shooters inexplicably submit their unresizable pics to the dpguru group
for
DPOD consideration. What most people don't realize, though, is that the public API gives directions for constructing the url of any photo
based on information in the HTML of every photo page.
The basic formats for the urls are:
http://photos{server-id}.flickr.com/{id}_{secret}_[mstb].jpg and
http://photos{server-id}.flickr.com/{id}_{secret}_o.(jpg|gif|png)
If you've downloaded images from flickr, this may look familiar. If not, don't worry. All that says is that the url for any image is the word "photos" followed by a server-id number, followed by ".flickr.com/" followed by the member's id number, followed by "_" and a unique number that identifies the picture, followed by an optional "_" and letter to indicate size, followed by ".jpg". That's for the standard flickr image sizes. You can also get the original uploaded image if you know what file type it was by constructing a url ending in "_o." and then "jpg," "gif," or "png," depending on what the person uploaded. For the vast majority of pictures on flickr, it's going to be "jpg."
The size letters are fairly straight forward: if you don't put anything, it's the medium size that's 500px on it's longest size. The other letters are:
-
s small square 75x75
-
t thumbnail, 100 on longest side
-
m small, 240 on longest side
-
[none] medium, 500 on longest side
-
b large, 1024 on longest side (only exists for very large original images that were resized during upload)
-
o original image, either a jpg, gif or png, depending on source format
So now what about the
rest?
In your browser, go to the page for a pic you want to see larger, and use your browser's "view
source" option (Ctrl U for Firefox users). About 1/8 of the way down the page, more if you're a Greasemonkey user like me, you'll see some code that looks like
this:
<!--
photo_hash['29305573'] = new Object();
photo_hash['29305573'].id = '29305573';
photo_hash['29305573'].server = '23';
photo_hash['29305573'].secret = '7c9bb5849e';
What we%uFFFDre interested here, as you%uFFFDve probably guessed, is %uFFFDid,%uFFFD %uFFFDsecret,%uFFFD and %uFFFDserver%uFFFD to plug into our url formula. Now that we have them, we can go look at the picture in different sizes. For instance, the url for the medium size would be http://photos23.flickr.com/29305573_7c9bb5849e.jpg. If we want to see the original, it%uFFFDs at http://photos23.flickr.com/29305573_7c9bb5849e_o.jpg. If we don%uFFFDt want something quite 2107x1704px, we can take a look at that large size: http://photos23.flickr.com/29305573_7c9bb5849e_b.jpg.








1. I hope you guys know that you're going to piss off a lot of people by popularizing this information. I share mine, but most of the people who turn off the "all sizes" option are trying to keep people from being able to easily download their images.
I guess it doesn't matter that much, since anyone using Greasemonkey could figure out the URL thing by themselves, but I'm just warning you about a possible sh*tstorm.
Posted at 6:26AM on Dec 19th 2005 by carpeicthus