Christian Heilmann

Retrieve and display Flickr photos the easy way with getFlickrBy

Saturday, May 9th, 2009 at 6:34 am

As part of my talk on YQL for Open Hack London I’ve thought of an easy way to get Flickr photos that you are allowed to display in your products and hacks.

The wrapper API getFlickrBy works around the somewhat convoluted data returned from Flickr’s API methods and uses YQL to cut the information you want down to the bare necessities. Furthermore the API only returns photos that are licenced with Creative Commons’ “By” license to avoid you using photos you have no right to use (which is a big thing with the Flickr crowd).

The API endpoint is:

http://isithackday.com/api/getFlickrBy.php

You have several parameters to play with:

location
The location you want photos of as defined in the Yahoo Geo API
search
A word you want to search for
format
The format of the returned data, XML, HTML or JSON - preset is XML
callback
A name of a JavaScript function call to wrap the JSON data in, in case you want to use the API in a script node
amount
The amount of photos returned, max is 100 – preset is 20
size
the photo size, “s” for 75×75px, “t” for thumbnail, “m” for medium, omit to get big size

The API returns only what you need: the image title, the owner, the url of the image and the link to Flickr. If you use html as the output format it returns an HTML list of linked images. For output demos and explanations simply call the API without any parameters

Here are some examples how to use the API:

Tags: , , , ,

Share on Mastodon (needs instance)

Share on Twitter

My other work: