Understanding Flickr Photo Size Suffixes
When I built some image galleries for this site, I had to get cozy with Flickr’s developer API. There are a few gotchas in there, so I thought it would be nice to save someone else a few minutes of headache and just post some answers. Today’s gotcha involves the way Flickr’s image suffixes work.
If you go look at the sources for Flickr images, you’ll notice that they tend to end with an underscore and a letter. This is how Flickr sorts out which size to serve up. For example, a suffix of “s” means that you want a 75×75 pixel square. There’s a list of the suffixes here, along with some excellent example urls.
There’s one confusing point on that page, however: There is no “-” suffix. They wrote that to indicate that there’s nothing. If you try to load an image with a dash in the name, you’ll get a broken link. It’s also important to note that the underscore is part of the suffix. A standard-sized image has no underscore.
Example of a Suffix in Use
So an example of a correct image source for an image that’s
640px on the longest side would be:
Example of an image Without a Suffix
If you want something at the default size of
500px on the longest side, then you would use no suffix at all:
Here’s a direct image link from the Flickr example pages that you can use to swap out suffixes and play around. It may seem like a small thing, but when you’re coding late at night and you’re avoiding coffee because you need to sleep someday, that dash in the documentation can be a serious source of consternation. Hopefully I’ve saved you a bit of that.