Facebook PHP SDK:获取(裁剪)专辑封面 [英] Facebook PHP SDK: Getting (cropped) album cover

查看:82
本文介绍了Facebook PHP SDK:获取(裁剪)专辑封面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook的PHP SDK和Graph API从一个用户那里获取所有相册,然后将其显示给他,以便他可以选择要浏览的相册.我希望它们像Facebook一样显示在网格中:每张图片的宽度和高度都相同.

I am using Facebook's PHP SDK and Graph API to obtain all albums from one user, and then display them to him so he can select which album he will browse. I want them displayed in a grid, just like Facebook does: every picture with the same width and height.

问题是当我这样做时:

   $fb->api('/' . $album_id . '/picture?access_token=' . $accessToken 

我得到的图片具有原始尺寸,而不是当您单击照片时Facebook向您显示照片的方式,即调整为固定大小的裁剪版本.

I get a version of the picture with the original dimensions, and not the way that Facebook shows them to you when you click on Photos, i.e. a cropped version adjusted to a fixed size.

我尝试将?square添加到请求中,但仍然得到相同的结果.

I have tried adding ?square to the request, but still getting the same result.

有什么想法吗?

推荐答案

相册支持的类型为thumbnailsmallalbum,要检索其中一种,请使用:

Supported types for albums are thumbnail, small and album and to retrieve one of them you use:

$fb->api('/' . $album_id . '/picture?type=album&access_token=' . $accessToken 

这篇关于Facebook PHP SDK:获取(裁剪)专辑封面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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