在facebook图形api中获取child_attachments的全分辨率照片


Obtain full resolution photos for child_attachments in facebook graph api?

我想获得每个子附件中返回的图像的完整分辨率,但我只得到一个图像url。

这是我对facebook图形的调用:

$FB_graph_JSON = file_get_contents('https://graph.facebook.com/'.$FB_UserPageID.'/feed?limit=20&fields=from,full_picture,message,picture,child_attachments,object_id&'.$FB_fresh_token);

我可以获得帖子本身的完整图片,但不能从子附件中获得,子图片的大小不太适合我的应用程序。

有没有办法为孩子取回全分辨率的图像?

查看子附件中的图片值。它们是这样一种格式:

https://external.xx.fbcdn.net/safe_image.php?d=xxx&url=http%3A%2F%2Fwww.example.com.tw%2Fsites%2Fdefault%2Fmy.jpg

URL参数正是您想要的。

您只需要提取url参数并对其执行URI组件解码,就可以获得该子级的全分辨率图像。

添加附件字段并在[subattachments]节点中找到全分辨率的图像

$FB_graph_JSON = file_get_contents('https://graph.facebook.com/'.$FB_UserPageID.'/feed?limit=20&fields=from,full_picture,message,picture,attachments,child_attachments,object_id&'.$FB_fresh_token);