Link | image_scalewithin |
Author | Jason Huck |
Category | Image |
Version | 8.x |
License | Public Domain |
Posted | 16 Jan 2006 |
Updated | 10 Sep 2007 |
More by this author... |
Scales the specified image within the given dimensions, maintaining the aspect ratio of the original image. Requires [math_proportion], available here.
inline( -username='xxxxxx', -password='xxxxxx' ); image_scalewithin( -source='before.tiff', -target='after.gif', -width=300, -height=300 ); /inline;
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( 'scalewithin', -namespace='image_', -priority='replace', -required='source', -type='string', -required='target', -type='string', -required='width', -type='integer', -required='height', -type='integer', -description='Scales the specified image within the given dimensions.' ); fail_if( !file_exists(#source), -1, 'The specified file could not be found.' ); local('img') = image(#source); local( 'mW' = @#width, 'mH' = @#height, 'oW' = @#img->width, 'oH' = @#img->height, 'nW' = integer, 'nH' = integer ); if(#oW >= #oH); #nW = #mW; #nH = math_proportion(#oW,#oH,#nW,'x'); if(#nH > #mH); #nH = #mH; #nW = math_proportion(#oW,#oH,'x',#nH); /if; else; #nH = #mH; #nW = math_proportion(#oW,#oH,'x',#nH); if(#nW > #mW); #nW = #mW; #nH = math_proportion(#oW,#oH,#nW,'x'); /if; /if; #img->scale( -width=#nW, -height=#nH, -thumbnail ); #img->save(#target); /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
RE: Doesn't get along with Filemaker