NAME

WebService::Thumbalizr - Perl extension for Thumbalizr (https://thumbalizr.com/), a web service to create screenshots of web pages.

SYNOPSIS

use WebService::Thumbalizr;

my $thumbalizr = WebService::Thumbalizr->new(key => 'my_key', secret => 'my_secret');
my $url = $thumbalizr->url('http://www.google.com/');
my ($status, $image) = $thumbalizr->download($url);

DESCRIPTION

Thumbalizr (http://www.thumbalizr.com/) is a web service to easily embed live screenshots of any URL in your website. Thumbalizr has full support for Flash, JavaScript, CSS, & HTML5.

The latest API version is detailed at https://www.thumbalizr.com/api/documentation.

The source code is available on github at https://github.com/juliensobrier/thumbalizr-perl.

METHODS

new()

my $thumbalizr = WebService::Thumbalizr->new((secret => 'my_secret', key => 'my_embed_key', debug => 1]);

Create a new WebService::Thumbalizr object. You must pass your API secret (login to your Thumbalizr account to display your secret).

Arguments:

key

Required. Embed API key.

secret

Required. Thumbalizr secret.

base
Optional. Base URL for all API requests. You should use the default base provided by the library. Be careful if you decide to use HTTP instead of HTTPS as your API key could be sniffed and your account could be used without your consent.
debug

Optional. Set to 1 to print debug output to the standard output. 0 (disabled) by default.

timeout

Optional. Set the request timeout - in seconds - against the API. Defaults to 90s.

last_error contains the last error message, it is NEVER reset, i.e last_error may not be empty after a successful API call if an earlier call failed.

url()

my $thumbalizr = WebService::Thumbalizr->url($url, size => 'page, bwidth => 1280, bheight => 1024);

Return the Thumbalizr URL to retrieve the screenshot. See https://thumbalizr.com/api/documentation for the full list of options

Arguments:

url

Required. URL of the website to create a screenshot of.

download()

my ($status, $image) = $thumbalizr->download($url);

Download a screenshot. Optionally, you can save the image directly to a file.

Return the status of the screenshot (OK, FAILED or QUEUED), and the image data or image file name. In case the screenshto is not finished, the image data will be empty.

Arguments:

  • Required. Thumbalizr Embed URL generated by $tumbalizr->url

  • Optional A local file name to save the image to.

download_wait()

my ($status, $image) = $thumbalizr->download_wait($url);

Download a screenshot. Optionally, you can save the image directly to a file. Unlike the download() function, download_wait() will attempt to retrieve the screenshot until it is either finished (OK) or failed (FAILED).

Return the status of the screenshot (OK, FAILED ), and the image data or image file name. In case the screenshot is not finished, the image data will be empty.

Arguments:

  • Required. Thumbalizr Embed URL generated by $tumbalizr->url

  • Optional A local file name to save the image to.

  • Optional The number of seconds to wait between 2 tries. 10 by default.

SEE ALSO

See https://thumbalizr.com/api/documentation for the API documentation.

Create a free account at https://thumbalizr.com/member to get your free API key.

Go to https://thumbalizr.com/member to find your API key and secret after you registered.

AUTHOR

Julien Sobrier, <julien@sobrier.net>

COPYRIGHT AND LICENSE

Copyright (C) 2019 by Julien Sobrier

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 47:

You forgot a '=back' before '=head2'

Around line 279:

=back without =over

Around line 281:

=back without =over