Link | image_display |
Author | Jason Huck |
Category | Image |
Version | 8.x |
License | Public Domain |
Posted | 26 Oct 2005 |
Updated | 15 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.
image_display( -filepath='/path/to/file.gif', -width=200 ); ->
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.
define_tag( 'display', -namespace='image_', -req='filepath', -type='string', -opt='width', -type='integer', -opt='height', -type='integer', -opt='absolute', -type='boolean', -opt='id', -opt='class', -opt='title', -opt='alt', -priority='replace', -encodenone, -description='Writes an HTML image tag with scaled dimensions. Calculates the correct missing dimension.' ); fail_if( !file_exists(#filepath), -1, 'Image does not exist.' ); local('image') = image(#filepath); local( 'oW' = @#image->width, 'oH' = @#image->height, 'nW' = (local_defined('width') ? #width | 0), 'nH' = (local_defined('height') ? #height | 0) ); select(true); 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; /select; local('out' = ''); return(#out); /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Re: max size