|
Cookbook /
FlickrGallerySummary: Create thumbnail galleries linked to flickr.
Version: 2012-01-21
Prerequisites: pmwiki-2.2.x and phpFlickr API kit by Dan Coulter
Status: Beta
Maintainer: Kaptainkory
Categories: Images
Discussion: FlickrGallery-Talk?
Questions answered by this recipeHow can I add a flickr gallery to my wiki? DescriptionUse this recipe to add a flickr gallery to your wiki. You should be able to run any flickr API method that responds with either photos or photosets. See Notes. Installation
## Include Flickr Gallery.
include_once("$FarmD/cookbook/flickrgallery.php");
$FlickrGallery['FlickrAPI'] = '<replace with your flickr API key>';
(:flickrgallery:) ConfigurationThe following default variables may be set in your config: $FlickrGallery['FlickrAPI'] = NULL; $FlickrGallery['FlickrSecret'] = NULL; $FlickrGallery['DieOnError'] = false; $FlickrGallery['EnableCache'] = false; $FlickrGallery['CacheType'] = 'fs'; $FlickrGallery['CachePath'] = $_SERVER['DOCUMENT_ROOT'] . '/cache'; # Also available, but open flickrgallery.php to see default values: $FlickrGallery['HTMLWrapper']; $FlickrGallery['HTML']; $FlickrGallery['HTMLErrorWrapper']; ###### $FlickrAPI['Method'] = 'flickr.photos.getRecent'; # Any flickr API arguments may be set in $FlickrAPI[]. # The following are just a couple of examples: $FlickrAPI['photoset_id'] = '72157628658158003'; $FlickrAPI['per_page'] = '10'; You may wish to review the flickr API for documentation on valid methods and arguments. Also, see Notes. On a wiki page, directive arguments may override any of the $FlickrAPI[] variables. The following are a couple of valid examples: (:flickrgallery:) (:flickrgallery photosets.getPhotos photoset_id="72157628658158003":) (:flickrgallery method="flickr.groups.pools.getPhotos" group_id="1336624@N23" tags="deer":) This probably goes without saying, but for security reasons you definitely do NOT want to include flickr API key or secret information in a directive posted to a publicly editable wiki page. You can style the appearance of the thumbnails with CSS:
.flickrgallery img {
margin: 0.05em 0 0.2em;
border: 1px solid transparent;
}
.flickrgallery img:hover {
border: 1px solid #DD6900;
}
You may also incorporate lightbox functioning for pretty display and navigation. Add the following to config for slimbox2 use. Be sure to revise the src and href URLs to match your setup. $HTMLHeaderFmt['slimbox'] = ' <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="/wiki/pub/slimbox/js/slimbox2.js"></script> <link rel="stylesheet" href="/slimbox2.css" type="text/css" media="screen" />'; NotesYou MUST specify a valid flickr API key in config for this recipe to work! This recipe was built to process publicly accessible flickr images. While any of the available flickr API methods may be called, the script is written to process only the following responses: <photos ...> <photo ... /> <photo ... /> </photos> <photoset ...> <photo ... /> <photo ... /> </photoset> A few flickr API methods that are compatible with this recipe include, but not limited to:
The method flickr.photos.search really offers a lot of oomph for more complex dealings. Processing of other flickr API responses could theoretically be written into flickrgallery.php without too much coding effort. Change log / Release notes
See also
ContributorsCommentsSee discussion at FlickrGallery-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. |