Lasso Soft Inc. > Home

  • Articles

Website thumbnails with WebThumb

A quick'n'dirty method to get website thumbnails

Simple Example

First, you'll need to signup for a free account to this service : http://webthumb.bluga.net/register

Then, log into the site into your profile page to get two numbers : your User ID and API key, we'll need them right now.

Create a file called thumbnail.lasso and paste this inside, changing the API key and User ID to yours

!insert lassoscript here
Lasso_ExecutionTimeLimit: 60;
local('url') = client_param('url')!=''? client_param('url') | 'http://www.lassosoft.com';
local('apikey') = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';  //free webthumb API key
local('userid')= 'xxx';
local('size')= client_param('size')!=''?client_param('size')!=''|'medium2';
local('cache')= client_param('cache')!=''?client_param('cache')!=''|'1';

local('service_url') = 'http://webthumb.bluga.net/easythumb.php';
local('datestamp') = date_format((Date_LocalToGMT:date),-Format='%Y%m%d');
local('hash') = string(#datestamp + #url + #apikey);

var('url_params')=array('user'= #userid,
			'url' = #url,
			'size' = #size,
			'cache' = #cache,
			'hash'  = encrypt_MD5(#hash));
			
local('response') = include_url(#service_url, -getparams=$url_params, -timeout=60);


if: string_extract(#response, -startposition='7', -endposition='11') !>> 'JFIF';
	'Error: '#response;	
else;		
	file_serve(#response, -file='example.jpg', -type='image/jpeg',-inline);
/if;

?>

 

You can now call this page, which will output a LassoSoft site thumbnail JPEG named example.jpg as default values. Modify this to your convenience and you've got your thumbnail system.

Another example

A more complete ctag is available on tagswap : http://tagswap.net/cms_easythumb

Author: Dominique Guardiola
Created: 28 May 2008
Last Modified: 2 Mar 2011

Comments

No comments found
You must be logged in to comment.

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft