如何获取特定尺寸的相册照片

时间:2013-06-02 17:45:31

标签: facebook facebook-graph-api photos

我可以很好地检索相册的照片列表,是的,在返回的照片数组中有不同的尺寸,我的问题是:有没有办法指定要返回的图像的尺寸。

从/ photos call

返回的数组
[id] => COVER PHOTO ID
[from] => Array(
    [name] => FB_USER NAME
    [id] => FB_USER ID
)
[name] => PHOTO NAME
[picture] => https://photos-b.xx.fbcdn.net/hphotos-ash4/xxxxxxxxxxxx_s.jpg
[source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s720x720/xxxxxxxxxxxx_n.jpg
[height] => 540
[width] => 720
[images] => Array(
    [0] => Array(
        [height] => 1224
        [width] => 1632
        [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/xxxxxxxxxxxx_o.jpg
    )

    [1] => Array(
        [height] => 720
        [width] => 960
        [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/xxxxxxxxxxxx_n.jpg
    )

    [2] => Array(
        [height] => 540
        [width] => 720
        [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s720x720/xxxxxxxxxxxx_n.jpg
    )

    [3] => Array(
        [height] => 450
        [width] => 600
        [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s600x600/xxxxxxxxxxxx_n.jpg
    )
    ... other sizes
    [link] => ALBUM LINK
    [icon] => https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif
    [created_time] => 2012-10-14T03:52:17+0000
    [updated_time] => 2012-10-14T03:52:17+0000
)

有没有办法使用相册的封面照片ID和图片/图片api来调整大小?

https://developers.facebook.com/docs/reference/api/using-pictures/

请注意你可以做什么?width = xxxx& height = xxxx

1 个答案:

答案 0 :(得分:1)

你不能。

this doc所示,您只能调整图片的大小,而不是照片。

  • 图片只是代表对象的一种方式,例如个人资料,活动,网页或相册。图片的作用简单,标识,描述或其他;这就是为什么它们应该适合任何类型的展示。
  • 照片是您在相册中找到的照片。这些是对象本身,不需要表示图片。我猜逻辑要求照片不要调整大小,因为它们不应该变性。

因此,您必须自己调整这些照片的大小。至少,您可以为照片选择尺寸。

相关问题