获取所有图像大小flickr api

时间:2012-11-18 19:47:08

标签: javascript json flickr

我想获得单个flickr图像的所有图像大小的列表,我需要能够获得调整大小的图像的URL,所有这些都是json格式。

我想得到类似的东西

[
 {width:200,height:200,url:"http://flickr.com/200ximage.jpg"}
,{width:400,height:400,url:"http://flickr.com/400ximage.jpg"}
,{width:600,height:600,url:"http://flickr.com/600ximage.jpg"}
,{width:800,height:800,url:"http://flickr.com/800ximage.jpg"}
]

如何构建网址?我找不到任何可理解的指南!!!!

这是针对响应式图像脚本btw

2 个答案:

答案 0 :(得分:4)

尝试:

flickr.photos.getSizes

http://www.flickr.com/services/api/flickr.photos.getSizes.html

返回照片的可用尺寸。主叫用户必须有权查看照片。 认证

此方法不需要身份验证。

参数

api_key(必填) 您的API应用程序密钥。有关详细信息,请参见此处。

photo_id(必填) 要获取大小信息的照片ID。

响应示例

<sizes canblog="1" canprint="1" candownload="1">
  <size label="Square" width="75" height="75" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_s.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/sq/" media="photo" />
  <size label="Large Square" width="150" height="150" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_q.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/q/" media="photo" />
  <size label="Thumbnail" width="100" height="75" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_t.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/t/" media="photo" />
  <size label="Small" width="240" height="180" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_m.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/s/" media="photo" />
  <size label="Small 320" width="320" height="240" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_n.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/n/" media="photo" />
  <size label="Medium" width="500" height="375" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/m/" media="photo" />
  <size label="Medium 640" width="640" height="480" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_z.jpg?zz=1" url="http://www.flickr.com/photos/stewart/567229075/sizes/z/" media="photo" />
  <size label="Medium 800" width="800" height="600" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_c.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/c/" media="photo" />
  <size label="Large" width="1024" height="768" source="http://farm2.staticflickr.com/1103/567229075_2cf8456f01_b.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/l/" media="photo" />
  <size label="Original" width="2400" height="1800" source="http://farm2.staticflickr.com/1103/567229075_6dc09dc6da_o.jpg" url="http://www.flickr.com/photos/stewart/567229075/sizes/o/" media="photo" />
</sizes>

答案 1 :(得分:1)

您是否知道可以从Flickr @william malo收集原始尺寸图像的任何方法或源代码?