Lasso Soft Inc. > Home


AuthorJason Huck
LicensePublic Domain
Posted26 Oct 2005
Updated15 Feb 2008
More by this author...


This tag is useful in cases where an image must be scaled to fit within the HTML of a page and the need to properly include both dimensions outweighs the extra processing time required for the calculation. A perfect example is HTML emails for antiquated clients such as Lotus Notes.

Requires the path to the image and whichever new dimension is known. Optionally accepts an "absolute" param if the generated image tag should use an absolute URL.

Sample Usage



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.

	-req='filepath', -type='string',
	-opt='width', -type='integer',
	-opt='height', -type='integer',
	-opt='absolute', -type='boolean',
	-description='Writes an HTML image tag with scaled dimensions. Calculates the correct missing dimension.'
		'Image does not exist.'
	local('image') = image(#filepath);
		'oW' = @#image->width,
		'oH' = @#image->height,
		'nW' = (local_defined('width') ? #width | 0),
		'nH' = (local_defined('height') ? #height | 0)
		case(#nW == 0 && #nH != 0);
			#nW = (#oW * #nH) / #oH;
		case(#nW != 0 && #nH == 0);
			#nH = (#nW * #oH) / #oW;
		case(#nW == 0 && #nH == 0);
			#nW = #oW;
			#nH = #oH;
	local('out' = '');


18 Feb 2008, Jason Huck

Re: max size

No, it doesn't do this as currently written, but it would be easy enough to add.

18 Feb 2008, Dominique Guardiola Falco

max size

Can I give this tag both -height and -width , I mean the max height and the max width and it takes the bigger, makes it fit, and the second size follow keeping the ratio ?
Is this english?

15 Feb 2008, Jason Huck


Updated to include options for the following HTML attributes: id, class, title, alt.

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