Lasso Soft Inc. > Home

[cms_easythumb]

Linkcms_easythumb
AuthorDominique Guardiola Falco
CategoryImage
Version8.5.x
LicensePublic Domain
Posted19 Jan 2008
Updated17 Oct 2009
More by this author...

Description

Use the WebThumb snapshot Service to create a JPEG snapshot of a given URL. It requires you sign up for the service.
Returns a HTML tag containing the URL to the JPEG thumbnail. This simple GET method permits 3 differents type of snapshots

  • small = 80 x 60 pixels
  • medium = 160 x 120 pixels
  • medium2 = 320 x 240 pixels

The image can be long to show (few seconds), so saving the file for future use using the -file option can be useful.

 

A XML API is availble at WebThumb, with more options (excerpts, PNG support, custome sizes, etc)

Sample Usage

cms_easythumb(
        -url= 'http://www.example.com',
	-userid= 'xxxx',
	-apikey= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');


To display the  with custom CSS class an ID ,and 
download the thumbnail in a given path.

cms_easythumb(
        -url= 'http://www.example.com',
	-file='/my/absolute/file/path/myfilename.jpg',
	-size='medium2',
	-userid= 'xxxx',
	-apikey= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

//lasso

/*----------------------------------------------------------------------------

Use the WebThumb Service to create a JPEG snapshot of a given URL
It requires you sign up for the service at http://webthumb.bluga.net/
Returns the URL to pickup the snapshot.

-file='/filepath/image.jpg'
If you use this option, a file will be created or overwrited and the tag
will return the filepath.

small = 80 x 60
medium = 160 x 120
medium2 = 320 x 240
larger = ?

----------------------------------------------------------------------------*/

define_tag: 'easythumb',
	-namespace='cms_',
	-priority='replace',	
	-required='url',
	-required='apikey',
	-required='userid',
	-optional='file',
	-optional='size',
	-optional='cache',
	-optional='content_keyvalue',
	-optional='id',
	-optional='class',
	-optional='debug',
	-encodenone;
	
	Lasso_ExecutionTimeLimit: 60;
	
	local('service_url') = 'http://webthumb.bluga.net/easythumb.php'; //can change some day
	!local_defined('size')? local('size') = 'small';  //  {small | medium | medium2}		
	!local_defined('cache')? local('cache') = '1';
	local('datestamp') = date_format((Date_LocalToGMT:date),-Format='%Y%m%d');

	local('string_url') = string(#service_url + '?user=' + #userid + '&url=' + encode_url(#url) + '&size=' + #size + '&cache=' + #cache + '&hash=' + encrypt_MD5(#datestamp + #url + #apikey));

	local('response') = include_url(#string_url, -timeout=0);

	if: string_extract(#response, -startposition='0', -endposition='30') !>> 'JFIF';


		//the long french error message is here to explain with a link that
		//perhaps the targeted web site uses some strange redirection
		//the system could not follow, it says : check the real URL before.
		Error_SetErrorMessage( 'Error: '+string(#response));
		return('Erreur: '#response'
Relancez la création d'icône en cliquant sur l'onglet «texte» puis à nouveau sur l'onglet «icône».
Attention: Il se peut que l'adresse de siteque vous avez fournie ('#url') ne soit pas vraiment celle de la page d'accueil. Essayez de cliquer ici.
Si le site utilise une redirection, c'est à dire si l'adresse figurant dans la barre d'dresse est différente de celle que vous avez fournie, recopiez la véritable adresse pour que notre système puisse prendre une photo d'écran correctement.'); else; local('result') = ' -userid= '#userid'
-size='#size'
-content_keyvalue='local('content_keyvalue')'
-url='#url'
-apikey='#apikey'
URL = '#string_url'
'error_currenterror' 'file_currenterror; error_code != '0' ? return(error_currenterror' 'file_currenterror)|return(#result); /if; /define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

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