如何获得特定大小的相册照片 [英] How to get a specific size album photo

查看:116
本文介绍了如何获得特定大小的相册照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以检索一张专辑的照片列表,但是有没有返回的照片数组中有不同的大小,但是我的问题是:有没有办法指定要返回的图像的尺寸。 p>

从/ photos调用返回的数组

  [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] =>数组(
[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

...其他尺寸
[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

解决方案

你不能。



此文档所示,您只能调整图片,而不是照片。




  • 图片只是一种方式to 表示一个对象,如个人资料,事件,页面或专辑。图片作为简单的表示,标志,描述或其他任何工作;这就是为什么他们应该适合任何形式的展示。

  • 照片是您将在相册中找到的照片。这些是自己的对象,不需要一个图片来表示。我猜这个逻辑想让照片不能被调整大小,因为它们不应该被改变。



所以,你必须调整这些照片自己至少您可以为照片选择尺寸。


I can retrieve the list of photos of an album just fine and yes there are different sizes in the photos array returned, my question however is: is there any way to specify the dimensions of the image you want to return.

Array returned from /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
)

Is there any way to use the album's cover photo id with the graph /picture api to resize?

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

Notice how you can do ?width=xxxx&height=xxxx

解决方案

You can't.

As this doc indicates, you can only resize pictures, not photos.

  • Pictures are only a way to represent an object, like a profile, an event, a page or an album. Pictures work as simple representation, logo, description or whatever ; this is why they should fit to any kind of displaying.
  • Photos are the photos you will find in an album. These are objects themselves and doesn't need a picture to be represented. I guess the logic wants photos not to be resized, because they shouldn't be denaturalized.

So, you will have to resize these photos yourself. At least, you can choose a dimension for your photo.

这篇关于如何获得特定大小的相册照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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