116 facebook facebook-graph-api
我现在正在开发一个主要基于facebook graph api的Web应用程序.我持有一些关于用户的数据 - 实际上是可用的公共数据 - 例如名称和ID.我也知道个人资料图片是公共数据的一部分,我想知道如何才能通过使用他的ID获得用户个人资料图片的直接链接?
提前致谢
Zac*_*tel 278
http://graph.facebook.com/"+ facebookId +"/ picture?type = square例如:http://graph.facebook.com/67563683055/picture?type = square
除了"square"之外还有更多尺寸.查看文档.
Dul*_*iri 120
您可以使用以下网址来获取不同大小的个人资料图片.请确保将Facebook ID添加到网址.
大尺寸照片 https://graph.facebook.com/ {facebookId}/picture?type = large
中等大小的照片 https://graph.facebook.com/ {facebookId}/picture?type = normal
小尺寸照片 https://graph.facebook.com/ {facebookId}/picture?type = small
方形照片 https://graph.facebook.com/ {facebookId}/picture?type = square
rey*_*ard 36
获得最大尺寸的图像
https://graph.facebook.com/{userID}?fields=picture.width(720).height(720)
Run Code Online (Sandbox Code Playgroud)
或者你需要的任何其他尺寸.根据经验,type = large不是您可以获得的最大结果.
Sad*_*Ali 17
这将是有用的链接:
http://graph.facebook.com/893914824028397/picture?type=large&redirect=true&width=500&height=500
您可以根据需要设置高度和宽度
893914824028397是facebookid
Igy*_*Igy 13
这实际上在Graph API文档的首页上.
/OBJECT_ID/picture 返回重定向到对象的图片(在这种情况下是用户)/OBJECT_ID/?fields=picture 返回图片的URL例子:
<img src="https://graph.facebook.com/4/picture"/> 使用HTTP 301重定向到Zuck的个人资料图片
https://graph.facebook.com/4?fields=picture 返回URL本身
Edd*_*dyG 10
2020 年 9 月更新
Facebook 有新的要求变更:所有基于 UID 的查询都需要访问令牌
因此,您必须将您的应用访问令牌添加到 url:
https://graph.facebook.com/{profile_id}/picture?type=large&access_token={app_access_token}
Run Code Online (Sandbox Code Playgroud)
要让您app_access_token使用以下网址:
https://graph.facebook.com/oauth/access_token?client_id={your-app-id}&client_secret={your-app-secret}&grant_type=client_credentials
Run Code Online (Sandbox Code Playgroud)
您可以在 Facebook 开发者的 Facebook 应用程序的基本设置中找到your-app-id和your-app-secret
在这里,此API可让您轻松获取fb,google和twitter个人资料照片
当为Twitter,Facebook,Instagram和Gravatar等各种社交网络提供用户名时,该API会返回个人资料图片。它具有适用于iOS,Android,Ruby,Node,PHP,Python和JavaScript的库。
| 归档时间: |
|
| 查看次数: |
218958 次 |
| 最近记录: |