This API should can be used to embed thumbnails directly on your website. For the old API (not recommended), check this link.
Your API key and Secret can be found in the member section after you sign up for a free account.
We provide a number of libraries and extensions for the major web frameworks and languages, along with code samples. Check out the libraries page.
https://api.thumbalizr.com/api/v1/embed/EMBED_API_KEY/TOKEN/?url=https://www.google.com/&mode=page
TOKEN is the MD5 of the URL query string and secret:
TOKEN = md5(url=https://www.google.com/&mode=pageSECRET)
The list of options available is shown below. Only the url parameter is required, other values default to the option you choose in your profile.
You need to ensure that all parameters are encoded correctly, especially the url parameter.
timestamp: use a different timestamp to geenrate a new image. You can use any string but we recommend to use the current date: timestamp=2017-02-04:18:56:03
country: you can take screenshots from US or Germany. Contact us for other countries.
bwidth and bheight define the viewport of the browser.
You can track the status of the screenshots through the HTTP headers sent back by thumbalizr.com:
X-Thumbalizr-Status: status of the screenshot:
X-Thumbalizr-Generated: date the screenshot was generated, for example 02 Apr 2014 11:03:24 GMT.
X-Thumbalizr-Error: reason why the screenshot failed.
We provide a number of libraries and extensions for the major web frameworks and languages, along with code samples. Check out the libraries page.
<?php
function thumbalizr($url, $options = array()) {
$embed_key = 'MY_EMBED_API_KEY'; # replace it with you Embed API key
$secret = 'MY_SECRET'; # replace it with your Secret
$query = 'url=' . urlencode($url);
foreach($options as $key => $value) {
$query .= '&' . trim($key) . '=' . urlencode(trim($value));
}
$token = md5($query . $secret);
return "https://api.thumbalizr.com/api/v1/embed/$embed_key/$token/?$query";
}
?>
<img src="<?php echo thumbalizr("https://browshot.com/", array('width' => 300, 'size' => 'page')); ?>" title="Screenshot done with Thumbalizr">
<img src="<?php echo thumbalizr("google.com"); ?>" title="Screenshot done with Thumbalizr">
import hashlib
import urllib
def thumbalizr(url='', options={}):
embed_key = 'MY_EMBED_API_KEY' # replace it with you Embed API key
secret = 'MY_SECRET' # replace it with your Secret
query = 'url=' + urllib.quote_plus(url)
for key, value in options.items():
query += '&' + key + '=' + urllib.quote_plus(str(value))
token = hashlib.md5(query + secret).hexdigest()
return "https://api.thumbalizr.com/api/v1/embed/%s/%s/?%s" % (embed_key, token, query)
print thumbalizr("https://browshot.com/", { 'width': 300, 'size': 'page' })
print thumbalizr("google.com")
require 'url'
require 'digest'
def thumbalizr(url='', options={})
embed_key = 'MY_EMBED_API_KEY' # replace it with you Embed API key
secret = 'MY_SECRET' # replace it with your Secret
query = 'url=' + CGI::escape(url.to_s)
options.each_pair do |key, value|
query += "&#{key}=" + CGI::escape(value.to_s)
end
token = Digest::MD5.hexdigest(query + secret)
return "https://api.thumbalizr.com/api/v1/embed/#{embed_key}/#{token}/?#{query}"
end
puts thumbalizr("https://browshot.com/", {:width => 300, :size => 'page' })
puts thumbalizr("google.com")
#!/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";
}
#!/bin/bash
EMBED_KEY="MY_EMBED_API_KEY" # replace it with you Embed API key
SECRET="MY_SECRET" # replace it with your Secret
URL="https://browshot.com/" # URL must be encoded appropriately
OPTIONS="width=300&size=page"
TOKEN=$(echo -n "url=$URL&$OPTIONS$SECRET" | md5sum | cut -d " " -f 1)
curl "https://api.thumbalizr.com/api/v1/embed/$EMBED_KEY/$TOKEN/?url=$URL&$OPTIONS"
# sh thumbalizr.sh > thumbnail.png