I'm querying an album's photos using the graph api explorer.
graph.facebook.com/[album_id]/photos
The result includes an "images" key which lists eight image versions. The largest is listed as 2048x1529
, however when I open the actual image it is only 604x451
, which are the dimensions listed for the next largest version.
My app needs to know accurate image dimensions ahead of time. How can I reliably find the largest available image's dimensions?
Recommended image dimensions: 1200×628 pixels. Minimum image dimensions: 200×200 pixels. Minimum image dimensions for link page posts with larger images: 600×315 pixels (If your image is smaller than 600×315 pixels, it will still display in the link page post but the size will be much smaller.) Maximum image size: 8 MB.
The ideal image size for a Facebook image post is 720px, 960px, or 2048px wide, with flexibility in the corresponding height.
Given that the results returned from ALBUM_ID/photos are not reliable, I believe the following approach is the closest you can get to your intention of getting the dimensions of the largest image version:
You can retrieve the dimensions of the enlarged image you see when you click a photo in an album online. This image is referred to as src_big
in the FQL
photo table. You retrieve the dimensions with this FQL
query:
SELECT src_big_width, src_big_height
FROM photo
WHERE object_id=OBJECT_ID
where OBJECT_ID is the photo's Facebook object id number.
The call looks like this,
https://graph.facebook.com/fql?q=SELECT src_big_width,src_big_height FROM photo WHERE object_id=OBJECT_ID
You need
friends_photos
user_photos
permissions and an access token.
To get the url to the src_big image, add src_big to the query:
SELECT src_big, src_big_width, src_big_height
FROM photo
WHERE object_id=OBJECT_ID
The src_big image has a maximum width or height of 720 pixels if the image was uploaded before March 1, 2012. If it was uploaded after that date, the maximum is 960 pixels.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With