WebService::Thumbalizr - Perl extension for Thumbalizr (https://thumbalizr.com/), a web service to create screenshots of web pages.
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);
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.
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:
Required. Embed API key.
Required. Thumbalizr secret.
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.
Optional. Set to 1 to print debug output to the standard output. 0 (disabled) by default.
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.
last_error
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
Required. URL of the website to create a screenshot of.
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.
Required. Thumbalizr Embed URL generated by $tumbalizr->url
Optional A local file name to save the image to.
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).
download()
download_wait()
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.
Optional The number of seconds to wait between 2 tries. 10 by default.
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.
Julien Sobrier, <julien@sobrier.net>
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:
You forgot a '=back' before '=head2'
=back without =over
To install WebService::Thumbalizr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Thumbalizr
CPAN shell
perl -MCPAN -e shell install WebService::Thumbalizr
For more information on module installation, please visit the detailed CPAN module installation guide.