javascript – 获取所有图像大小flickr api
作者:互联网
我想获得单个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"}
]
我该如何构建网址?我在任何地方找不到任何可理解的指南!!!!
这是一个响应式图像脚本顺便说一句
解决方法:
尝试:
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>
标签:json,javascript,flickr 来源: https://codeday.me/bug/20190620/1246863.html