Description
Adds a rectangular border around the outside edge of a ColdFusion image.
Returns
Nothing.
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:
|
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.
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"/>
<!--- 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"/>
<!--- 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"/>
<!--- 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"/>