如何通过PHP获得特定标签和用户的小Flickr图像?

时间:2011-06-14 23:15:53

标签: php flickr

我想要做的是创建一个PHP脚本,它将获得它找到的第一个具有特定标记的Flickr图像,并返回小图像的URL(缩略图上方的大小)。如果您不确定我的意思是小尺寸,请访问http://www.flickr.com/photos/napix/3353191223/sizes/s/in/photostream/

3 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

我明白了。看看我问的这个跟进问题。这个问题的答案在另一个问题中:How can I get one photo for every Flickr tag by a specific user in one request?

答案 2 :(得分:0)

function flickr_feed ( $tag ) {
    $f = new phpFlickr("MY API KEY", "MY API SECRET");
    $tags = $f->photos_search(array("tags"=>$tag, "tag_mode"=>"any","per_page"=>"20"));
    $counter="0";
    foreach ($tags['photo'] as $photo) {
        if($counter =="0" || $counter =="5" || $counter =="10" || $counter =="15") { $first = " first"; } else { $first = ""; }
        echo '<div class="flickr-thumb'.$first.'">
                <a rel="nofollow" target="_blank" href="http://farm'.$photo['farm'].'.static.flickr.com/'.$photo['server'].'/'.$photo['id'].'_'.$photo['secret'].'.jpg" title="'.$photo['title'].'">
                <img src="http://farm'.$photo['farm'].'.static.flickr.com/'.$photo['server'].'/'.$photo['id'].'_'.$photo['secret'].'_s.jpg" alt="'.$photo['title'].'"></a>
            </div>';
        $counter++;     
    }
}