Flickr::Embed - Simple embedding of Flickr pictures into HTML
use Flickr::Embed; my $fe = Flickr::Embed::embed( tags=>'carrots', key=>'key', secret=>'secret', ); my $blog = "$fe{html}This is a post which will appear on my blog.". "<br/><i>$fe{attribution}</i>";
When you have an automated system to produce blog posts, sometimes you want to attach random pictures to it on some theme or other. For example, you might post the output of your unit tests every day and decide it would look good if each one had a different picture of a camel next to it. Flickr::Embed will look up your search terms on Flickr and return a given picture each time.
Flickr::Embed
Returns a hash of information taken from Flickr. In list context, returns everything it received from Flickr, subject to exclusions. In scalar context, returns just the first one, subject to exclusions. The return type is described in THE CONTENTS OF THE HASH, below. Takes a set of named parameters, described below.
A Flickr API key. See WHERE TO GET A KEY, below. Required.
A Flickr API secret. See WHERE TO GET A KEY, below. Required.
Tags to look for. Separate multiple tags with commas; only pictures which match all given tags will be returned. Required.
An arrayref of IDs of photos not to retrieve, presumably because you've seen them already.
How many photos to return (if this call is in list context). You will get at most this many; if any exclusions match, or if there aren't enough photos on Flickr with the given tags, you will get fewer.
A block of HTML ready to paste into a blog post.
An attribution of the author, including the licence. Most Creative Commons licences require attribution, and anyway it's good manners, so be sure to put this in somewhere.
for this photo, and and also
for the current size; see the Flickr API documentation.
http://www.flickr.com/services/api/keys/apply/
If you don't have this, most of the tests will be skipped.
If you exclude all the pictures in the first fetch, Flickr::Embed does not yet go back and get another batch; it behaves as if there were no pictures found. By default this will only happen if you have at least 100 exclusions. This will be fixed in a later release.
Flickr::API.
Flickr::API
Thomas Thurman, tthurman@gnome.org.
This Perl module is copyright (C) Thomas Thurman, 2009. This is free software, and can be used/modified under the same terms as Perl itself.
To install Flickr::Embed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Flickr::Embed
CPAN shell
perl -MCPAN -e shell install Flickr::Embed
For more information on module installation, please visit the detailed CPAN module installation guide.