Facebook Graph API 更改:图片类型(大小)不再有效?

Facebook Graph API Change: Picture type (size) no longer working?(Facebook Graph API 更改:图片类型(大小)不再有效?)
本文介绍了Facebook Graph API 更改:图片类型(大小)不再有效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

根据 Facebook 的 Graph API 文档(此处),您可以通过 URL 访问各种尺寸的用户个人资料图片,例如:

According to Facebook's Graph API documentation (here), you can access various sizes of a user's profile picture through URLs such as:

https://graph.facebook.com/(userid)/picture?type=small
https://graph.facebook.com/(userid)/picture?type=large

您会注意到第一个解析为以 _t.jpg(小缩略图)结尾的 url,第二个以 _n.jpg(大图像)结尾.到现在为止还挺好.同样,我们应该能够像这样查询这些图像:

You'll notice that the first resolves to a url ending in _t.jpg (the small thumbnail) and the second ending in _n.jpg (the large image). So far so good. Equivalently, we should be able to query for these images like this:

https://graph.facebook.com/(userid)?fields=picture&type=small
https://graph.facebook.com/(userid)?fields=picture&type=large

后一种格式按预期工作了好几个月,直到几天前它突然开始完全忽略类型"参数 - 现在一切都解析为以 _q.jpg 结尾的图像,如果没有,这是默认值类型"指定.结果,我再也找不到在 PHP 中查询大图像的方法(我的真正问题).它曾经是这样工作的:

This latter format worked as expected for many months, until just a few days ago when it suddenly started ignoring the "type" parameter entirely - everything now resolves to an image ending in _q.jpg, which is the default if no "type" is specified. As a result, I can no longer figure out a way to query for the large image in PHP (my real problem). It used to work like this:

$pic = $facebook->api('/me', array('fields' => 'picture', 'type' => 'large'));

...但如上所述,类型"已自发地开始被忽略.我花了几个小时浏览他们的文档,但找不到任何关于已更改内容的参考,或者应该完成的新"方式 - 任何指针都将不胜感激...

...but as described above, "type" has spontaneously started being ignored. I've spent several hours scouring their documentation but haven't been able to find any reference to what has changed, or the "new" way this should be done - any pointers would be hugely appreciated...

以下都不起作用(不返回任何内容):

None of the following work, either (returns nothing):

$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');

基本上,由于 Facebook 几天前出事了,似乎没有任何方法可以从 PHP 获取非默认图片大小.您可以自己从 Graph API Explorer 尝试一些调用(here).

Basically, since Facebook broke things a few days ago there doesn't seem to be any way to get a non-default picture size from PHP. You can try out some of the calls yourself from the Graph API Explorer (here).

其他相关/相关链接:

http://stackoverflow.com/questions/2978761/facebook-graph-api-will-not-give-me-picture-data
http://stackoverflow.com/questions/7718704/requesting-picture-for-event

推荐答案

我找到了一个解决方法 - 仍然可以通过 FQL 查询访问各种尺寸的个人资料图片:

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"));

(pic_big"相当于type=large" - 请参阅此处).

("pic_big" is equivalent to "type=large" - see here).

这仍然不能解释为什么 GRAPH 调用突然中断,或者为什么图像大小似乎不再可以通过 Graph 访问(我仍然想知道)......但至少有一些获取其他尺寸照片的方法.

This still doesn't explain why the GRAPH call suddenly broke though, or why image sizes don't seem to be accessible via Graph at all anymore (which I'd still like to know)...but at least there's some way to get the other size photos.

必须喜欢 Facebook 及其一流的可靠性...

Gotta love Facebook and their top-notch reliability...

这篇关于Facebook Graph API 更改:图片类型(大小)不再有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Facebook Login with Strict Mode for Redirect URIs(使用重定向 URI 的严格模式登录 Facebook)
How to retrieve post ID for a post i#39;ve just made via the Facebook API(如何检索我刚刚通过 Facebook API 发布的帖子的帖子 ID)
Facebook PHP SDK logout(Facebook PHP SDK 注销)
Facebook SDK and Graph API Comment Deleting Error(Facebook SDK 和 Graph API 评论删除错误)
PHP amp; Facebook: facebook-debug a URL using CURL and Facebook debugger(PHP amp;Facebook: facebook-debug a URL using CURL and Facebook debugger)
Can#39;t delete photo via Facebook API?(无法通过 Facebook API 删除照片?)