ColdFusion 9.0 Resources |
ImageResizeParameters
UsageYou can use this function to enlarge an image or create a thumbnail image. To specify the height or width in pixels, enter the integer, for example, 100. To specify the height or width as a percentage, enter the percentage followed by the percent symbol, for example, 50%. To resize an image by one dimension (for example, height), specify the height and leave width value blank (""). ColdFusion calculates the width proportionally to the height. Use the ImageSetAntialiasing function to improve the quality of the rendered image. Interpolation algorithmsInterpolation algorithms let you fine-tune how images are resampled. Each algorithm balances image quality against performance: in general, the higher the image quality, the slower the performance. Quality and performance differ based on image type and the size of the source file. The following table describes the algorithms and their named equivalents based on average test results:
Example<!--- This example shows how to resize an image to 50% of original size and resize it proportionately to the new width. Notice that the height is blank.---> <cfset myImage=ImageNew("http://www.google.com/images/logo_sm.gif")> <cfset ImageResize(myImage,"50%","","blackman",2)> <!--- Save the modified image to a file called "test_myImage.jpeg" and display the image in a browser. ---> <cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> <!--- Display the source image and the thumbnail image. ---> <img src="http://www.google.com/images/logo_sm.gif"/> <img src="test_myImage.jpeg"/> |