kakacii
kakacii

Reputation: 740

Using facebook graph api how to get news feed with large picture size if the feed type is photo?

Using facebook graph api get News feed: https://graph.facebook.com/me/home?access_token=...

The picture field it returns is all in smallest size, like picture": "https://fbcdn-photos-b-a.akamaihd.net/hphotos-ak-ash3/xxxxxx4_s.jpg:

Is there any parameter that I can use to retrieve larger thumbnails? Any way to do this?

Upvotes: 25

Views: 25072

Answers (7)

ClockworkOrange
ClockworkOrange

Reputation: 587

You can add custom field list for returning object.

?fields=full_picture

will return full size image.

Upvotes: 43

bighonestjohn
bighonestjohn

Reputation: 328

I have found that swapping the characters at the end of the file URL to _n, _b or _o no longer work.

Facebook has released graph API 2.0 which can be used to solve this problem.

Here is the solution:

1. Get the object_id from the post you want the image from

In every Post object there maybe an object_id field. This field only appears if the post has a picture of video (i.e. type = 'photo' or 'video')

2. Make a GET request to https://graph.facebook.com/v2.0/{object_id}?access_token={token}

e.g. if object_id = 123 and your access token = abc then the URL to call becomes https://graph.facebook.com/v2.0/123?access_token=abc

This API call gets more information about the given object_id. Since the object_id in this case represents a photo, the response will contain the various versions of the photo.

The response this request can be found here: https://developers.facebook.com/docs/graph-api/reference/v2.0/photo

3. Take the largest dimensioned image from the images field

The response from the API call has a field names images. This contains small to large sizes of the image. Just take the largest one.

Upvotes: 17

Srinivas Kattimani
Srinivas Kattimani

Reputation: 336

it returns the smallest size i.e., 130x130. to get the bigger size try replacing that with

320x320

480x480

600x600

720x720

Upvotes: 0

Yawar
Yawar

Reputation: 1943

Along with picture field, there is an object_id field. Put this id in below url:

https://graph.facebook.com/{object_id}/picture

This will return actual size image. Or you can write this for different image sizes.

https://graph.facebook.com/{object_id}/picture?type=normal

Where type can be : thumbnail, normal, album.

Upvotes: 13

Shriram
Shriram

Reputation: 165

Even swapping _s for _l or _b might result in a larger thumbnail.
But at times it results in invalid request or a blank image rather a white dot on a dark background.
Ideally the api should specify crop, thumb, normal, and large (like on twitter network)with every picture object on network.

Upvotes: 0

kimpixel
kimpixel

Reputation: 1

you can make a extra request with the [object_id] of the post entry

$res = $facebook->api('/yourid', 'GET', $params);

Upvotes: 0

RandallB
RandallB

Reputation: 5565

I'm currently searching for the same thing. I know you can swap _s for _n at the end and get a larger size... but I haven't figured out how to have the api return the larger size on its own.

Upvotes: 4

Related Questions