J-Flickr is designed to be as unintrusive as possible in giving you access to the Flickr API service. This means that you are not limited to the methods you can call or hamstrung by the output of the plugin. If you want to search for photos with an Attribution License uploaded last year then you can, just as you can get a list of your public contacts or talk to the Flickr Pandas. Essentially you construct the shortcode as if making an API call and then either use one of the existing general templates or make your own! The templates are in XSL and operate directly on the XML sent back from Flickr so you’re never wanting for data that other plugins may not expose.
Get a list of photos updated in April 2009:
[flickr method="photos.recentlyUpdated" min_date="2009-04-01" extras="license,geo,tags"]
Get the photos from a specific group pool:
[flickr method="groups.pools.getPhotos" group\_id="57342295@N00" per\_page="25" page="4"]
Get the comments for a specific photo with a custom template:
[flickr method="photos.comments.getList" photo\_id="3459139116" max\_comment_date="2009-04-01" jflickr\_template="commentTemplate"]<h3>Thanks</h3>
Many thanks to Fabien MARTY for his PEAR Cache_Lite work.
I had originally intended to include a web-based template editor with version 1.0 but decided that it muddied the purity of what I was trying to achieve. J-Flickr is still very much a developer led plugin and it seemed an odd usage of time for fluffy UI elements, especially for a 1.0 release.
In no particular order:
- Admin template manager
- Proper, remote API key validation
- WP Media integration
- Tighter error checking of prerequisites (writable cache directory etc.)
- Better error reporting than silence or crunchy PHP output
- Authentication support
These should all be included in a 2.0 release although the development of that will likely depend on interest (if any) of this version.
- Can I use method x?
You can use any method of the Flickr API that doesn’t require authentication. Some methods make more sense than others to use, if a method doesn’t return any output then you’re using the plugin for the wrong thing.
- How do I define my own templates?
There is a ‘templates’ directory within the plugin directory that contains a selection of XSL templates. The included ones are for the (what I would imagine) are the most used result sets but making your own is as easy as creating a valid XSL template and dropping it and then using it (see the Examples section).
If you wish for a certain method to always use a certain template just name the template after the method sans the ‘flickr.’ prefix, e.g. for the method ‘interestingness.getList’ name your file ‘interestingness.getList.xsl’. Case sensitivity will be based on your hosts file system.
- What is the template priority?
If you define a template in the shortcode this will be used before all others, if one is not defined or the file does not exist then the plugin will search for a method template, if that doesn’t exist it will fallback to the general templates. The ‘photos.xsl’ template is the standard and should not be deleted.
- What is the cache for?
The cache exists to be friendly to Flickr, they’ve been awesome enough to provide a solid API so you should be friendly back to them by not hammering the service. Essentially every shortcode instance you put in your blog is an API call, if the cash didn’t exist then every request for a page with the shortcode would be an API request. So say you have 5 front page posts each with one shortcode instance, if 1000 visited in a day, thats 5000 API requests just for the homepage.
You are responsible for managing the number of connections and queries to the Flickr API
- What is a good cache time?
I’ve set the default to be 1 day as that’s plenty of time between requests. The higher the value the better really, so if you only update your Flickr account at weekends then feel free to set it to 5 days (432,000 seconds) or longer.