Adds a rectangular border around the outside edge of a ColdFusion image.
Nothing.
ImageAddBorder(name
,thickness
[,color
,borderType
])
cfimage, ImageDrawRect, IsImageFile
ColdFusion 8: Added this function.
Parameter |
Description |
---|---|
name |
Required. The ColdFusion image on which this operation is performed. |
thickness |
Required. Thickness of the border in pixels. The default value is 1. The border is added to the outside edge of the image; the image area is increased accordingly. |
color |
Optional. Border color. The default border color is black. See Usage. Only valid if the borderType is not specified or if borderType = "constant". |
borderType |
Optional. The type of border:
|
The 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 name list in Valid HTML named colors. For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx", where x = 0-9 or A-F; use two number signs or none.
Example 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"/>