Facebook Graph high resolution photos

前端 未结 7 2536
余生分开走
余生分开走 2021-02-15 09:18

I\'m doing a Facebook Graph API call for \"me/home\" to get the user\'s news feed. As everyone knows, the URL you get in the \"picture\" field is a low resolution photo that doe

相关标签:
7条回答
  • 2021-02-15 09:43

    The graph api returns response which includes images and webp_images and it has image links in all available resolutions.

    As per the latest version: v2.12

    For profile photo:

    /me?fields=photos{picture,images,webp_images}
    

    For specific album:

    'album-id'?fields=photos{picture,images,webp_images}
    

    Field details:

    photos: array of available photos, this will return json like below:

    {
        data: [],
        pagin: []
    }
    

    In data object we'll get below fields:

    picture: link for a low resolution image might be for the use of thumbnails

    images: array of objects for picture image with the different different resolutions in raster format

    webp_images: array of objects for picture image with the different different resolutions in webp format

    images and web_images object will have data like:

    {
        height: number, // 400
        source: 'link for the image with the resolution of height and width specified', //https:....
        width: number //496
    }
    
    0 讨论(0)
  • 2021-02-15 09:54

    For some reason none of the answers to this question worked, however, one person on another forum posted to use "full_picture" in the fields perameter and it worked like a charm. I didn't find this in any of the docs...unless I just overlooked it?

    OP https://www.quora.com/How-do-I-get-the-full-size-of-image-in-a-Facebook-post-using-Graph-API

    0 讨论(0)
  • 2021-02-15 09:57

    me/home - graph api has some a field called "object_id" and "type". If the type is "photo" then you will have this object_id value. By Using this object id and make another graph api call then you will get an objecty called "images". This object has several options ( different sizes ).

    OR

    Use object id like below and get a album sized version of a photo. and the supported types for this call are "thumbnail, normal, album".

    https://graph.facebook.com/{object-id-from-feed}/picture?type=normal 
    

    and also checkout this link under Examples of Supported Objects section.

    0 讨论(0)
  • 2021-02-15 10:05

    Use this:

    /user_id/?fields=picture.height(961)
    

    It will give the maximum possible resolution picture.

    0 讨论(0)
  • 2021-02-15 10:07

    Its a late response but but I have found a better approach

    If you have got a address by using graph api like this

    https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xaf1/t1.0-9/s130x130/10501892_701590943222768_782659935906208443_n.png
    

    then just replace 130x130 to a valid resolution

    https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xaf1/t1.0-9/s480x480/10501892_701590943222768_782659935906208443_n.png
    

    and you will be able to get high resolution image

    Valid image resolution can be found from this example call

    http://graph.facebook.com/701586786556517

    701586786556517 = object_id from Facebook graph API call

    Hope this helps someone.

    0 讨论(0)
  • 2021-02-15 10:07

    All you need to do is (Graph API):

    http://graph.facebook.com/me?fields=picture.height(961) 
    // all any height which u want
    

    or (for other user)

    http://graph.facebook.com/{user_id}?fields=picture.height(961) 
    // replace {user_id} with the user id you want
    

    UPDATE :

    Since Facebook API will keep updating, This solution may be deprecated. This workaround solution might not work in future.

    You may also need Access Token to execute this endpoint.

    0 讨论(0)
提交回复
热议问题