Reputation: 65
I'm using this to get thumbnail image: https://graph.facebook.com/806640129377133/picture
But this outputs image sized 160 x 160px and I need at least 640 x 360 px. I tried several methods (like this: https://graph.facebook.com/806640129377133/picture?type=large) but nothing works. How can I get bigger thumbnail?
Upvotes: 0
Views: 575
Reputation: 1884
Thanks @CBroe for the original solution.
Here is the simplest way to get the highest resolution thumbnail of a facebook video.
$request_url ="https://graph.facebook.com/{VIDEO_ID}/?fields=format{picture,width,height}";
$requests = file_get_contents($request_url);
$fb_response = json_decode($requests);
echo end($fb_response->format)->picture; //highest resolution image available
Spent half a day looking for this! Hope I'm saving your time! :D
Upvotes: 0
Reputation: 96151
The method luschn mentioned is the normal one to ask for pictures with specific dimensions; however here it doesn’t seem to work, specifying larger values for width/height still gives only the 160×160 version.
If you look at the format
field however, it shows something like this,
"format": [
{
"embed_html": "<iframe src=…></iframe>",
"filter": "130x130",
"height": 130,
"picture": "…",
"width": 130
},
{
"embed_html": "<iframe src=…></iframe>",
"filter": "native",
"height": 400,
"picture": "…",
"width": 400
}
],
So a bigger version of the picture is available, in this case sized 400×400.
Although it even mentions a filter
property in there, I have not yet found a way to get it to spit out the large picture only – but you could loop through this and see which one has the largest width/height yourself.
And if you make that call ?fields=format{picture,width,height}, you will get only the picture
, width
and height
properties (if you want to keep the footprint small and avoid requesting unnecessary data).
Upvotes: 2
Reputation: 73984
This is how to get the picture in the desired resolution:
https://graph.facebook.com/[Graph-ID]/picture?width=121&height=100
It may be a bit bigger, but it will have the set width and height parameters as minimum values.
If it does not work, the image is probably not uploaded in a resolution that is big enough. This works great for profile pictures of profiles (avatars), but in that case it is a video and i doubt that you will get a larger one.
Upvotes: 0