Adds a rectangular border around the outside edge of a ColdFusion image.

imageAddBorder(name, thickness [, color] [, bordertype]) → returns void

Member Function Syntax

someImage.addBorder(thickness [, color] [, bordertype])

imageAddBorder Argument Reference

name string

The image on which this operation is performed.

thickness string

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 string
Default: black

Only valid if the borderType is not specified or if borderType = 'constant'.

bordertype string
Default: constant

The type of border.
  • zero
  • constant
  • copy
  • reflect
  • wrap

Examples sample code invoking the imageAddBorder function

Tag Syntax

Draw a green border around the outside edge of the red border.

<cfset imageAddBorder(myImage,5,"green")>    

Tag Syntax

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")>    

Tag Syntax

Create the border.

<cfset imageAddBorder(myImage,100,"","reflect")> 

Tag Syntax

Create a ColdFusion image from an existing JPEG file.

<cfset imageAddBorder(myImage,100,"","copy")>  

Using addBorder member function

CF 11+ Lucee 4.5+ Add border with optional color parameter

imgObj = imageRead("");
cfimage(action="writeToBrowser", source=imgObj);

Fork me on GitHub