Facebook Graph API更改:图片类型(大小)不再工作? [英] Facebook Graph API Change: Picture type (size) no longer working?

查看:293
本文介绍了Facebook Graph API更改:图片类型(大小)不再工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Facebook的Graph API文档( here ),您可以通过以下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(小缩略图)结尾的网址,第二个结尾为_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,如果没有指定type,它是默认值。因此,我无法再找到一种方式来查询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 - 请参阅 here )。

("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更改:图片类型(大小)不再工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆