Photo Image URLs
You can construct the source URL to a photo once you know its ID, server ID, and secret as returned by many API methods.
The URL takes the following format:
# # Typical usage # https://live.staticflickr.com/{server-id}/{id}_{secret}_{size-suffix}.jpg # # Unique URL format for 500px size # https://live.staticflickr.com/{server-id}/{id}_{secret}.jpg # # Originals might have a different file format extension # https://live.staticflickr.com/{server-id}/{id}_{o-secret}_o.{o-format} # # Example # server-id: 7372 # photo-id: 12502775644 # secret: acfd415fa7 # size: w # https://live.staticflickr.com/7372/12502775644_acfd415fa7_w.jpg
Size Suffixes
The various sizes offered on Flickr have the following letter suffixes:
Suffix | Class | Longest edge (px) | Notes |
---|---|---|---|
s | thumbnail | 75 | cropped square |
q | thumbnail | 150 | cropped square |
t | thumbnail | 100 | |
m | small | 240 | |
n | small | 320 | |
w | small | 400 | |
(none) | medium | 500 | |
z | medium | 640 | |
c | medium | 800 | |
b | large | 1024 | |
h | large | 1600 | has a unique secret; photo owner can restrict |
k | large | 2048 | has a unique secret; photo owner can restrict |
3k | extra large | 3072 | has a unique secret; photo owner can restrict |
4k | extra large | 4096 | has a unique secret; photo owner can restrict |
f | extra large | 4096 | has a unique secret; photo owner can restrict; only exists for 2:1 aspect ratio photos |
5k | extra large | 5120 | has a unique secret; photo owner can restrict |
6k | extra large | 6144 | has a unique secret; photo owner can restrict |
o | original | arbitrary | has a unique secret; photo owner can restrict; files have full EXIF data; files might not be rotated; files can use an arbitrary file extension |
Secrets
All photo image URLs use a secret value that's provided by API methods. All sizes below the H (1600) size use one shared secret. All sizes above and including the H (1600) size each use a unique secret for just themselves. The original size, regardless of dimensions, always uses its own secret.
A few more notes on originals
The original size behaves a little differently than the other sizes. They have their own secret (called originalsecret
in responses) and a variable file extension (called originalformat
in responses). These values are returned via the API only when the caller has permission to view the original size (based on a user preference and various other criteria). The values are returned by the flickr.photos.getInfo method and by any method that returns a list of photos and allows an extras
parameter (with a value of original_format
), such as flickr.photos.search. The flickr.photos.getSizes method, as always, will return the full original URL where permissions allow.
Additionally, since original files are the exact file uploaded to Flickr they may have extra EXIF, XMP, etc. metadata embedded within them. This might include rotation data which may result in the image displaying in an unexpected orientation. Metadata can also include sensitive info like geographic details. With these details in mind it is important to only expose access to original files when you know it's safe and required.
Image dimensions
A particular size will exist for one of three reasons:
- It’s one of these sizes which always exist:
s
,q
,t
,o
(subject to the original downloading pref). - It’s smaller than the original (subject to the max resolution pref).
- It’s larger than the original and the original is within a certain number of pixels of the size.
- This case is a little funny and worth thinking about. For example, it means that if you upload a ×ばつ1000 original then it will have a 1024 size even though it's smaller than that size normally is. The dimensions on that size will be ×ばつ1000 and the API will correctly report the dimensions as such. How many pixels of wiggle room each size has varies, but generally it’s "half the number of pixels between this size and the next smaller size".
Legacy URLs
In the past Flickr has supported several different styles for image URLs. These continue to work but are considered deprecated. Please update to the style detailed in this document.
Web Page URLs
URLs to photo and profile pages use either the user's NSID (the number with the '@' sign in it) or their custom URL (if they've chosen one). You can find their custom URL with a call to flickr.people.getInfo. The NSID version of the URL will always work, regardless of whether they've set up a 'pretty' URL, so you can avoid the API call by simply using the the user ID returned by most photo API calls.
You can then easily build URLs to profiles, photostreams, individual photos, or albums:
https://www.flickr.com/people/{user-id}/ - profile https://www.flickr.com/photos/{user-id}/ - photostream https://www.flickr.com/photos/{user-id}/{photo-id} - individual photo https://www.flickr.com/photos/{user-id}/albums/ - all albums https://www.flickr.com/photos/{user-id}/albums/{album-id} - single album
Other URLs can be constructed similarly. Directing a user to https://www.flickr.com/photos/me/*
or https://www.flickr.com/people/me/*
will replace the 'me
' with their own user ID, if they're logged in (otherwise it will redirect to the latest photos page).
Examples
https://www.flickr.com/photos/12037949754@N01/ https://www.flickr.com/photos/12037949754@N01/155761353/ https://www.flickr.com/photos/12037949754@N01/albums/ https://www.flickr.com/photos/12037949754@N01/albums/72157594162136485/
Short URLs
Flickr provides a URL shortening service for uploaded photos (and videos). Short URLs can be useful in a variety of contexts including: email, on business cards, IM, text messages, or short status updates.
Every photo on Flickr has a mathematically calculated short URL of the form:
https://flic.kr/p/{base58-photo-id}
Base58 is used to compress the photo-ids using a mix of letters and numbers. You can find more info on base58, and code samples in the Flickr API Group.