O'Reilly logo

Flickr Hacks by Jim Bumgardner, Paul Bausch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #14. Make a Flickr-Style Tag Cloud

Adding a tag cloud to your web site is easier than getting a bad haircut!

If the illustrations in these next few pages look familiar, you've seen tag clouds before. Tag clouds are clusters of tags rendered with differently sized fonts to indicate the relative popularity of the tags in a dataset. Click on any of the tags to retrieve data matching that tag (such as photos).

Flickr used tag clouds first, followed by other Web 2.0 sites such as Technorati. Now, tag clouds seem to be ubiquitous, appearing on nearly every new web site that wants to join the Web 2.0 party. Perhaps that's why Jeffrey Zeldman proclaimed tag clouds "the new mullets."

Fortunately for those of us who are still mulletless, Dan Steingart has written a script that makes a tag cloud from the tags associated with your Flickr photos. The script is nearly ready to go and requires just a few minor modifications.

What You'll Need

To use Dan's script, you'll need your own Flickr API key [Hack #40] .

You'll also need the phpFlickr scripts [Hack #41] (which also make authenticating other people a snap, although you won't need authentication for this hack). You can download these scripts from http://www.phpflickr.com.

To get started, install the phpFlickr scripts on your web site, as described in [Hack #41] . Then download and unpack Dan Steingart's cloudTagFlickr script, which is available from http://www.allthingsalceste.com/cloudtagflickrphp/.

The Code

In the cloudTagFlickr.php script, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required