简体   繁体   中英

Concerning the post picture size of facebook page/group feed by Graph Api

I am displaying feed/posts of facebook page/group via graph api in my site by calling this Url in php code -

https://graph.facebook.com/page_id/feed?access_token=token_value

Then, Among many type of posts, for a post of picture type i get picture url as

http://photos-g.ak.fbcdn.net/hphotos-ak-frc3/t1.0-0/1972372_10152261154160659_883879121_s.jpg

Now it's the small size as the last part "_s.jpg" indicates.But i want all picture sizes be large.So to achieve this what parameters are needed to include in the graph api url - " https://graph.facebook.com/page_id/feed?access_token=token_value " so that all picture/video type of posts' picture will be in large size??, so is there will be "_b.jpg" at last as i presume.Is that possible in one graph api call?

I searched through the google but no luck, but ended up planning that i would replace the last part of the pic url above with "_b.jpg" so that url will be like -

http://photos-g.ak.fbcdn.net/hphotos-ak-frc3/t1.0-0/1972372_10152261154160659_883879121_b.jpg

But are there any drawbacks for this hack?? what are the correct ways to achieve if possible in one graph api call.

notice,

/page/feed?fields=attachments

this will give you all of the attachments in their full sizes. worked charms for me

您可以使用FQL查询来获取页面Feed中使用的大型照片的源信息:

SELECT pid, object_id, src_big, src_big_width, src_big_height FROM photo WHERE object_id in (SELECT attachment.media.photo.fbid FROM stream WHERE source_id={page_id} AND actor_id={page_id})

Not sure if that's actually documented somewhere – but in Graph API Explorer, the “Search for a field” feature suggests a field called full_picture . A few quick tests suggest that for most feed items, it returns the original image that was used making the post, whether it was a picture uploaded with the post, a video thumbnail or whatever.

You can use it in your feed calls like this:

/{user-or-page-id}/feed?fields=full_picture,message,type,…

Only fields you will get by default when using the fields parameter are id and created_time , everything else you might be interested in ( message , type , from , etc.) you will have to ask for specifically as well.


That is for any type of feed item that might have a picture attached – expect for type:photo . For those, you get an object_id as well, and when you query that explicitly in a second request, you get an images data structure, that lists the different image sizes Facebook has on their CDN.

I have not found a wya to make it spit out that additional info within the original /foo/feed request in one go though – but if you collect all object_id that call delivers, you can use them in a second call like this to get the info for multiple objects at once:

/?ids=object_id1,object_id2,…&fields=images

with every feed there is a node name object-Id, use this id like this

graph.facebook.com/object-id/picture?type=large

if it shows question mark photo then use access_token=XXXXXX in query string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM