網頁

2013年9月22日 星期日

phpFlickr

phpFlickr version 3.1


I've just put out a new release of phpFlickr. I have updated all of the methods to the latest API version. As is usually the case, some of the methods I updated will break your existing code so that it can be compliant with Flickr's API docs. If your current version is working fine, there won't be much reason to upgrade until you need a new method.



使用 flickr API (phpFlickr) 抓取相簿相片

Search for photos using PHP and the flickr API



應用程式園地

flickr.photos.search


phpFlickr and getting images from Flickr

 

require_once("phpFlickr.php");
$f = new phpFlickr("<api key>");
  $photos = $f->photos_search(array( 'text' => '台北101' , 'per_page' => 2) 
 // array( 'lat'=>25.033408 ,'lon'=>121.564099  , 'per_page' => 2) // , 'radius' => 1

 );
 //print_r( $photos );

foreach($photos['photo'] as $photo) { 
 // the image URL becomes somthing like 
 // http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg  
 echo ''; 
  $image = "http://farm".$photo["farm"].".static.flickr.com/".$photo["server"]."/".$photo["id"]."_".$photo["secret"].".jpg";
  echo  $image;
}

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。