FlickrAlbum

Summary: Display images dynamically from Flickr
Status: Stable
Version: 2007-03-05
Prerequisites: PmWiki 2.0
Maintainer: JonHaupt
Discussion: FlickrAlbum-Talk?
Categories: Images

Questions answered by this recipe

  • Can I display Flickr images dynamically in my pages?

Description

Using this recipe will allow you to have albums of Flickr photos in your wiki that update automatically when new photos are added to Flickr. This recipe requires the use of the phpFlickr class written by Dan Coulter, a Flickr API key, and this recipe. You may also need to use MySQL (see below). Follow these steps to Flickr photos in your site:

  1. You will need a Flickr API key. You can apply for one here:
  2. Download and unpack into /cookbook/phpFlickr the latest version of phpFlickr from:
  3. Download flickr-album.phpΔ and place it in your cookbook folder.
    • You'll need to add a line or two to config.php to configure the cache. This is where MySQL comes in. There are two options, filesystem cache and database cache; but currently the filesystem cache is problematic and hopefully will be fixed in a later version.
  4. Enable flickr-album in your config.php with the following:
    • $FlickrAPIKey = "insert_your_API_key_here";
    • $FlickrDB = "mysql://user:password@localhost/dbname";
    • include_once("$FarmD/cookbook/flickr-album.php");

The script will display an album of photos by a given username. The album is contained in a div called "flickralbum" which can then be styled using skin or local css.

The simplest album can be created by using the markup (:flickralbum:) which will create an album of 12 of the most recent photos added to Flickr in 6 columns. (:flickralbum user=foo:) can, then, be used to create a similar album of recent photos by someone with the Flickr username foo, etc.

The following is a list of arguments possible for other combinations:

  • user=? - flickr userid
  • tags=? - tags to limit by, comma-delimited
  • columns=? - number of columns in album
  • number=? - total number of photos to show
  • type=recent - show most recent first
  • type=interesting - show most interesting photo first
  • size=? (Square, Thumbnail, Medium, Original - note: not all photos come in every size)
  • lightbox=1 (for lightbox, see below)

As of version 0.5, you can also specify that the images returned be displayed using Lightbox, using "lightbox=1". In order to do this, you have to install Lightbox JS on your server in a web-accessible location, then add the following to config.php:

  # lightbox
  $HTMLHeaderFmt['lightbox'] = "
    <script type='text/javascript' src='http://your.url/lightbox/js/prototype.js'></script>
    <script type='text/javascript' src='http://your.url/lightbox/js/scriptaculous.js?load=effects'></script>
    <script type='text/javascript' src='http://your.url/lightbox/js/lightbox.js'></script>";

For examples, see my test site. Hi. this link no longer works. are there any other working examples demonstrating how this recipe looks/feels? thanks! overtones99

Notes

Many other uses of phpFlickr are available and future tweaks of this recipe are planned, particularly for displaying photos in sets and groups.

  • This recipe was last tested on PmWiki version: 2.2.0.beta19
  • This recipe requires at least PmWiki version: 2

Updates

2007-05-03: Added global variables for database/filesystem caches, changed styling for images (now you should use .flickralbum in your CSS instead of #flickralbum).
2007-01-03: Worked on groups, added lightbox, fixed username error
2006-03-16: Made non-user-specific albums possible
2006-02-06: Added global variable for API key
2006-01-30: Initial release

See Also

Cookbook:FlickrGallery
Flash#flickr - doesn't use the Flickr api, but does allow quick and easy embedding of Flickr slideshows and videos
Cookbook:PictureGallery
Cookbook:EmbeddedGallery
Cookbook:SimpleGallery
Cookbook:SimpleImageFloat?

Contributors

Comments

See discussion at FlickrAlbum-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.