Met*_*450 7 php facebook facebook-graph-api
根据Facebook的Graph API文档(此处),您可以通过以下URL访问用户个人资料图片的各种大小:
https://graph.facebook.com/(userid)/picture?type=small
https://graph.facebook.com/(userid)/picture?type=large
Run Code Online (Sandbox Code Playgroud)
您会注意到第一个解析为以_t.jpg结尾的URL(小缩略图),第二个结束于_n.jpg(大图像).到现在为止还挺好.同样,我们应该能够像这样查询这些图像:
https://graph.facebook.com/(userid)?fields=picture&type=small
https://graph.facebook.com/(userid)?fields=picture&type=large
Run Code Online (Sandbox Code Playgroud)
后者的格式和预期一样多月,直到刚刚前几天,当它突然开始完全忽略了"类型"参数-现在一切都解决在_q.jpg结束的图像,这是默认的,如果没有"型"是指定.结果,我再也找不到在PHP中查询大图像的方法(我的真正问题).它过去像这样工作:
$pic = $facebook->api('/me', array('fields' => 'picture', 'type' => 'large'));
Run Code Online (Sandbox Code Playgroud)
......但如上所述,"类型"已经自发地被忽略了.我花了几个小时搜索他们的文档,但未能找到任何改变的参考,或者应该做的"新"方式 - 任何指针都会非常感激...
编辑:
以下所有工作都没有(不返回任何内容):
$pic = $facebook->api('/me/picture', array('type' => 'large'));
$pic = $facebook->api('/(my_uid)/picture', array('type' => 'large'));
$pic = $facebook->api('/me/picture/?type=large');
$pic = $facebook->api('/(my_uid)/picture/?type=large');
Run Code Online (Sandbox Code Playgroud)
基本上,由于Facebook几天前破坏了东西,似乎没有办法从PHP获得非默认图片大小.您可以从Graph API Explorer(此处)自己尝试一些调用.
其他相关/相关链接:
http://stackoverflow.com/questions/2978761/facebook-graph-api-will-not-give-me-picture-data
http://stackoverflow.com/questions/7718704/requesting-picture-for-event
Run Code Online (Sandbox Code Playgroud)
小智 19
您必须使用field_expansion语法请求API
这些api请求有效:
$results = $facebook->api('/me', array('fields' => 'picture.height(300).width(300)'));
$results = $facebook->api('/me', array('fields' => 'picture.type(large)'));
I found a workaround - profile pictures of various sizes can still be accessed via an FQL query:
$pic = $facebook->api(array('method'=>'fql.query', 'query'=>"SELECT pic_big FROM user WHERE uid=$fb_uid"));
Run Code Online (Sandbox Code Playgroud)
("pic_big" is equivalent to "type=large" - see here).
这仍然不能解释为什么 GRAPH 调用突然中断,或者为什么图像大小似乎不再可以通过 Graph 访问(我仍然想知道)......但至少有some way to get the other size photos.
一定会喜欢 Facebook 及其一流的可靠性......
| 归档时间: |
|
| 查看次数: |
19984 次 |
| 最近记录: |