Marvin3
Marvin3

Reputation: 6051

Flickr API: Get list of all images with specific sizes

When I fetch data from Flickr, by default it includes only big image and square thumbnail. Example response: http://api.flickr.com/services/feeds/photos_public.gne?id=46197864@N02&format=rss2

Is there any way to include there also another specific sizes http://www.flickr.com/services/api/flickr.photos.getSizes.html

Or I need to create separate request for each image?

I have access to all API keys e.t.c.

Thank you.

Upvotes: 3

Views: 2756

Answers (2)

Phạm Văn Thủy
Phạm Văn Thủy

Reputation: 11

In PHP. I used the page attribute to go to all result pages.

$page = 1;
$perPage = 500;
$tag = "flowers";

while ($page <= 10000){
  $url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search';
  $url.= '&api_key='.$api_key;
  $url.= '&tags='.$tag;
  $url.= '&per_page='.$perPage;
  $url.= '&format=json';
  $url.= '&nojsoncallback=1';
  $url.= '&page='.$page;

  $result = file_get_contents($url);
  $response = json_decode($result);

  //get info on each photo here

  //go to next page
  $page++;
}

Upvotes: 0

Marvin3
Marvin3

Reputation: 6051

Found, it, there is extras parameter in flickr.photosets.getPhotos method, it allows adding additional parameters to images like image sizes.

Upvotes: 3

Related Questions