PHP Script to Grab Image from Flickr with API

Grab image from flickr using API is easy to use. Flickr permits individuals to share about their particular pictures. If you would like to use of those photos, you can to download it.

PHP Script to Grab Image from Flickr with API

Flickr has provided a very simple API to manage, If previously I’ve shared articles ” Tutorial Scrape image from bing without API “, this time I will share how to use the API from flickr (specifically use the API to perform grab image from flickr massively).

 Lets view this video how to grab image from flickr tools work 

 Let’s begin to create a bulk image grabber from flickr 

To know more about flickrs API you can read here. In this session i will use only one method from Flickr APIs Methods

” Return a list of photos matching some criteria. Only photos visible to the calling user will be returned. To return private or semi-private photos, the caller must be authenticated with ‘read’ permissions, and have permission to view the photos. Unauthenticated calls will only return public photos. “

First you must have Flickr API`s Key before use that method, get the key here (Its free). Create new php file as flickr_grabber.php and copy this script below to your php file

Flickr Grab Image Explanation

Your keyword :

Count result : (max result is 500)

Size Image :

From The letter suffixes are as follows:

s small square 75×75
q large square 150×150
t thumbnail, 100 on longest side
m small, 240 on longest side
n small, 320 on longest side
– medium, 500 on longest side
z medium 640, 640 on longest side
c medium 800, 800 on longest side†
b large, 1024 on longest side*
h large 1600, 1600 on longest side†
k large 2048, 2048 on longest side†
o original image, either a jpg, gif or png, depending on source format

Flickr Image Source URL

” You can construct the source URL to a photo once you know its ID, server ID, farm ID and secret, as returned by many API methods. ”

The URL takes the following format :

https://farm{farm-id}{server-id}/{id}_{secret}.jpg or
https://farm{farm-id}{server-id}/{id}_{secret}_[mstzb].jpg or

You can add another arguments for method like license,page,max_upload, read here for more information.


Use flickr API is very easy to use, if you build wallpapers site, you can build bot or plugin auto generated image to your wordpress site. If I am free, I will make a plugin for grab image from flickr 🙂

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.