Ian Tyndall > Net-Amazon-Thumbnail-0.06 > Net::Amazon::Thumbnail

Download:
Net-Amazon-Thumbnail-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Net::Amazon::Thumbnail - Use the Amazon Alexa Site Thumbnail web service

SYNOPSIS ^

use Net::Amazon::Thumbnail;

        my %conf = (
        key_id  => "YoursecretkeyID",
            access_key  => "Yoursecretaccesskey",
        size    => "Large",
            path    => "C:/dev/thumbs/",
        no_image    => "noimage.jpg"
        );

        my $thumb = Net::Amazon::Thumbnail->new(\%conf);

        # Request single thumbnail
        my $images = $thumb->get_thumbnail('amazon.com');

        # Request multiple thumbnails
        my @domains = ('http://perlmonks.org', 'http://perl.com');
        $images = $thumb->get_thumbnail(\@domains);

        # Request with custom name (when path is provided)
        my %domain = ('perl.com' => 'TheSourceForPerl');
        $images = $thumb->get_thumbnail(\%domain);

DESCRIPTION ^

The Net::Amazon::Thumbnail module allows you to use the Amazon Alexa Site Thumbnail web service with relative ease.

The Alexa Site Thumbnail web service provides developers with programmatic access to thumbnail images for the home pages of web sites. It offers access to Alexa's large and growing collection of images, gathered from its comprehensive web crawl. This web service enables developers to enhance web sites, search results, web directories, blog entries, and other web real estate with Alexa thumbnails images.

In order to access the Alexa Web Information Service, you will need an Amazon Web Services Subscription ID. See http://www.amazon.com/gp/aws/landing.html

There are some limitations, so be sure to read the The Amazon Alexa Web Information Service FAQ.

INTERFACE ^

The interface follows. Most of this documentation was copied from the API reference. Upon errors, an exception is thrown.

new

The constructor method creates a new Net::Amazon::Thumbnail object. You must pass in a hash reference containing the Amazon Web Services Access Key ID, Secret Access Key, thumbnail size (small or large), and the name of your default empty image. Optionally you can also provide a path to store the images.

        my $thumb = Net::Amazon::Thumbnail->new(\%conf);

Config

The configuration options have just a few requirements. The following keys are required:

key_id
    key_id  => "YoursecretkeyID",
access_key
    access_key  => "Yoursecretaccesskey",

The following keys are optional

size
    size    => "large",

Size of the returned thumbnail (Small = 111x82 pixels, Large = 201x147 pixels). If this parameter is not specified it defaults to "Large". The first letter of this paramater is automatically uppercased.

path
    path    => "C:/dev/thumbs/",

The location of where you want the thumbnails stored locally. Dies upon unsuccessful directory test.

no_image

The default image you want returned for queued thumbnails. If the thumbnail is not available, this is the image returned. If the path option was given, non existant images are not stored.

    no_image    => "noimage.jpg"

get_thumbnail

The get_thumbnail method retrieves the thumbnails for the sites given, and returns an array reference containing the thumbnail(s) requested.

This method only accepts one argument, which must be a reference.

Flexible argument types:
String (single domain)
        my $images = $thumb->get_thumbnail('http://perlmonks.org');
Array reference (multiple domains)
        my @domains = qw(http://cpan.org, sourceforge.net);
        my $images = $thumb->get_thumbnail(\@domains);
Hash reference (multiple domains with custom names)
        my %domains = (
                perlmonks.org => 'monastery',
                cpan.org        => 'cpan'
        );
        my $images = $thumb->get_thumbnail(\%domains);  

If the path option was given, it will return the stored image instead of the image hosted on Amazon.

post_thumbnail

The post_thumbnail is exactly the same as get method, except that it dispatches a POST request instead of a GET request.

Although this method does work, the API says to use GET requests.

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests to bug-Net-Amazon-Thumbnail@rt.cpan.org. http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Amazon-Thumbnail is the RT queue for Net::Amazon::Thumbnail. Please check to see if your bug has already been reported.

AUTHOR ^

Ian Tyndall ityndall@cpan.org

COPYRIGHT ^

Copyright (c) 2007, Ian Tyndall ityndall@cpan.org. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: