Skip Navigation

Creating CAPTCHAs in our ColdFusion environment with Sandbox Security.

The following article explains how to use the cfimage tag to create CAPTCHAs in our shared ColdFusion environment with Sandbox Security.

Example 1 - Non functioning

<cfimage
action="captcha"
width="300"
height="75"
text="Captcha">

This will result in the following error message:

Example 2 - Functions

<cfset tc = GetTickCount()>
<cfimage
action="captcha"
width="300"
height="75"
text="Captcha"
destination="tmp/readme#tc#.png">

In Example 2, we are specifying that we will write the image as a PNG file in the tmp directory. This prevents any Sandbox Security issues. Also, by setting the variable "tc" to the value of "GetTickCount()" we insure that each file generated will have a unique name.

For further information on cfimage for ColdFusion 8 you can view Adobe's livedocs website here.