And*_*son 6 javascript facebook facebook-graph-api facebook-javascript-sdk react-native
我正在尝试使用React Native Facebook SDK获得高分辨率图片,但默认图像质量非常差.它是50x50,分辨率非常低.
请求:
new GraphRequest('/135121013672357',
{
parameters: {
fields: {
string: 'picture'
}
}
},
_responseInfoCallback
)
Run Code Online (Sandbox Code Playgroud)
响应
{
"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"
}
Run Code Online (Sandbox Code Playgroud)
查看Facebook的Graph API文档,有一个参数"type",可以请求特定大小(小,中,大).然而,不清楚的是如何格式化该请求.
picture?type=large // Error
picture{type:large} // 200 However, picture is omitted from Response
Run Code Online (Sandbox Code Playgroud)
您还可以使用 .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]
官方文档/{node-id}/picture位于https://developers.facebook.com/docs/graph-api/reference/user/picture/页面上。您可以在不通过应用程序调试的情况下试用 API:https : //developers.facebook.com/tools/explorer/
| 归档时间: |
|
| 查看次数: |
3855 次 |
| 最近记录: |