ColdFusion 9.0 Resources |
ImageAddBorderParameters
UsageThe thickness of the border is specified in pixels by the thickness parameter. The thickness cannot be less than 0. For the color value, specify a hexadecimal value or supported named color; see the list of valid HTML named colors in cfimagecfimage. For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx", where x = 0–9 or A–F; use two number signs or none. ExampleExample 1 <!--- This example shows how to create a 10-pixel-wide red border around an image with a 5-pixel-wide green border around the red border.---> <!--- Create a ColdFusion image from an existing JPEG file. ---> <cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage"> <!--- Draw a red border around the outside edge of the image. ---> <cfset ImageAddBorder(myImage,10,"red")> <!--- Draw a green border around the outside edge of the red border. ---> <cfset ImageAddBorder(myImage,5,"green")> <!--- Save the modified ColdFusion image to a file. ---> <cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> <!--- Display the source image and the new image. ---> <img src="../cfdocs/images/artgallery/jeff05.jpg"/> <img src="test_myImage.jpeg"/> Example 2 <!--- This example shows how to create a border from the tiled image. ---> <!--- Create a ColdFusion image from an existing JPEG file. ---> <cfimage source="../cfdocs/images/artgallery/lori05.jpg" name="myImage"> <!--- Add a 50-pixel-wide border to the outside edge of the image that is a tiled version of the image itself. ---> <cfset ImageAddBorder(myImage,50,"","wrap")> <!--- Save the modified ColdFusion image to a file. ---> <cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> <!--- Display the source image and the new image. ---> <img src="../cfdocs/images/artgallery/lori05.jpg"/> <img src="test_myImage.jpeg"/> Example 3 <!--- This example shows how to create a 100-pixel-wide border that is a mirror of the source image. ---> <!--- Create a ColdFusion image from an existing JPEG file. ---> <cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage"> <!--- Create the border. ---> <cfset ImageAddBorder(myImage,100,"","reflect")> <!--- Save the modified ColdFusion image to a file. ---> <cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> <!--- Display the source image and the new image. ---> <img src="../cfdocs/images/artgallery/maxwell01.jpg"/> <img src="test_myImage.jpeg"/> Example 4 <!--- This example shows how to copy 100 pixels from the outer edge of the image and create a border from it. ---> <!--- Create a ColdFusion image from an existing JPEG file. ---> <cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage"> <cfset ImageAddBorder(myImage,100,"","copy")> <!--- Save the modified ColdFusion image to a file. ---> <cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> <!--- Display the source image and the new image. ---> <img src="../cfdocs/images/artgallery/jeff05.jpg"/> <img src="test_myImage.jpeg"/> |