【问题标题】:Flickr API Not Returning Actual PhotosFlickr API 不返回实际照片
【发布时间】:2015-03-26 15:55:40
【问题描述】:

您好,我正在进行一个项目,想将 Flickr 用于我的图片库,我正在使用 photosets.* 方法,但每当我提出请求时,我都没有得到图像,我只能得到信息。

Json 结果:

{
    "photoset": {
        "id": "77846574839405047",
        "primary": "88575847594",
        "owner": "998850450@N03",
        "ownername": "mr.barde",
        "photo": [
            {
                "id": "16852316982",
                "secret": "857fur848c",
                "server": "8568",
                "farm": 9,
                "title": "wallpaper-lenovo-blue-pc-brand",
                "isprimary": "1",
                "ispublic": 1,
                "isfriend": 0,
                "isfamily": 0
            },
            {
                "id": "16665875068",
                "secret": "857fur848c",
                "server": "7619",
                "farm": 8,
                "title": "white_horses-1280x720",
                "isprimary": "0",
                "ispublic": 1,
                "isfriend": 0,
                "isfamily": 0
            }
        ],
        "page": 1,
        "per_page": "2",
        "perpage": "2",
        "pages": 3,
        "total": "6",
        "title": "My First Album"
    },
    "stat": "ok"
}

请希望返回实际的图像 URL,我该怎么做。

【问题讨论】:

标签: flickr phpflickr


【解决方案1】:

感谢@CBroe的评论

我在 Flickr API 文档中找到了这个。

一旦您知道照片的 ID、服务器 ID、农场 ID 和秘密(由许多 API 方法返回),您就可以构建照片的源 URL。

https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg
    or
https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}_[mstzb].jpg
    or
https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)

最后的结果会是这样的。

https://farm1.staticflickr.com/2/1418878_1e92283336_m.jpg

参考:https://www.flickr.com/services/api/misc.urls.html

【讨论】:

    猜你喜欢
    • 2010-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-14
    • 2012-07-05
    • 2011-04-05
    • 1970-01-01
    相关资源
    最近更新 更多