Enter your target URL:

Libraries for Perl and Template Toolkit

We provide a library for Perl and for Template Toolkit. The Perl module makes it easy to download your thumbnails, while the Template Toolkit plugin adds a custom tag thumbalizr.url to generate the Thumbalizr URL right inside your templates.

Quick code sample

The Perl code to generate a Thumbalizr URL is pretty simple, you can easily copy and paste it into your project:

#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;

use URI::Escape qw(uri_escape);
use Digest::MD5 qw(md5_hex);
use Text::Trim;



print thumbalizr("https://browshot.com/", 'width' => 300, 'size' => 'page'), "\n";
print thumbalizr("google.com"), "\n";

exit(0);

sub thumbalizr  {
	my ($url, %options) = @_;
	
	my $embed_key = 'MY_EMBED_API_KEY'; # replace it with you Embed API key
	my $secret = 'MY_SECRET'; # replace it with your Secret
	
	my $query = 'url=' . uri_escape($url);

	foreach my $option (keys %options)  { 
		$query .= '&' . trim($option) . '=' . uri_escape(trim $options{$option}); 
	}
	
	
	my $token = md5_hex($query . $secret);
	

	return "https://api.thumbalizr.com/api/v1/embed/$embed_key/$token/?$query";
}

Download code sample

Perl library

You can install WebService::Thumbalizr from CPAN. You'll find the source code in GitHub

Your API key and Secret can be found in the member section after you sign up for a free account.

#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;
use WebService::Thumbalizr;

my $thumbalizr = WebService::Thumbalizr->new(
	secret => 'MY_SECRET',
	key	=> 'MY_KEY',
);

my $url = $thumbalizr->url('https://blitapp.com/blog/', mode => 'page');
my ($status, $image) = $thumbalizr->download($url);
print "$url $status\n";

($status, my $file) = $thumbalizr->download($url, "blog.png");
print "$file $status\n";

($status, my $file) = $thumbalizr->download_wait($url, "blog.png");
print "$file $status\n";

Download code sample

Template Toolkit plugin

Add the Template::Plugin::Thumbalizr plugin to your Template Toolkit project to use thumbalizr.url in your templates:

[% USE thumbalizr = Thumbalizr('api_key', 'secret') %]
<img src="[% thumbalizr.url('https://www.google.com/', size => 'page', bheight => 1280) %]" />

You can set any of the API parameters supported: country, delay, etc.

Your API key and Secret can be found in the member section after you sign up for a free account.

You can find the source code of the Template Toolkit plugin on GitHub.