4

我试图使用React Native Facebook SDK获取高分辨率图片,但默认图像质量非常差。它是50x50和非常低的分辨率。如何使用React Native Facebook SDK GraphRequest获取高质量的个人资料照片?

请求:

new GraphRequest('/135121013672357', 
    { 
    parameters: { 
     fields: { 
     string: 'picture' 
     } 
    } 
    }, 
    _responseInfoCallback 
) 

响应

{ 
    "picture": { 
    "data": { 
     "is_silhouette": false, 
     "url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/16864988_145199975997794_4154735936748679550_n.jpg?oh=bb5f32ecb73dd9b8fb8ac45920e2ffc5&oe=593223A8" 
    } 
    }, 
    "id": "135121013672357" 
} 

Facebook's Graph API docs寻找,有一个参数, “类型”,其中一个可以请求特定大小(小,中,大)。然而不清楚的是如何格式化该请求。

picture?type=large // Error 

picture{type:large} // 200 However, picture is omitted from Response 

回答

3

您还可以使用.height和.WIDTH得到你需要它以更高分辨率的图片或决议:

示例端点480x{any-width}图片: /me?fields=id,name,picture.height(480),[:other_fields]

实施例端点{any-height}x480图像: /me?fields=id,name,picture.width(480),[:other_fields]

例端点最大分辨率图像: /me?fields=id,name,picture.height(10000),[:others_fields]

正式文件是在在https://developers.facebook.com/docs/graph-api/reference/user/picture//{node-id}/picture页。 而且您可以在不通过应用程序进行调试的情况下尝试API:https://developers.facebook.com/tools/explorer/

相关问题