Below is the source code for example.cfm


<!--- default values --->
<cfparam name="form.HMargin" default="10">
<cfparam name="form.VMargin" default="5">
<cfparam name="form.BgColor" default="FFFFFF">
<cfparam name="form.ListFontColor" default="000000,333333,666666,999999">
<cfparam name="form.ListFontStyle" default="plain,bold,italic,bolditalic">
<cfparam name="form.ListFontFace" default="Arial,Times New Roman,Serif,Sans Serif">
<cfparam name="form.ListFontSize" default="24,36,48">
<cfparam name="form.CaseSensitive" default="false">
<cfparam name="form.DotDensity" default="4">
<cfparam name="form.VerifyLength" default="5">
<cfparam name="form.CharList" default="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz">
<cfparam name="form.VerifyInput" default="">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>CF_Image_Verify Example</title>
    <style type="text/css">
        .textfield {  font-family: "MS Sans Serif"; font-size: 9pt; border: 1px solid #cccccc; }
        .button {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; color: #FFFFFF; background-color: #000000; cursor: hand}
        .tablestandard { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
    </style>
</head>

<body>
    <cfoutput>
    <h3>CF_Image_Verify Example</h3>
    <span class="tablestandard">(<a href="viewsource.cfm?source=example.cfm" target="source">View source code of this example page</a>)</span>
    <hr size=1>
    <table width="100%" cellpadding="2" cellspacing="2" border="0" class="tablestandard">
        <cfform action="example.cfm" method="POST" enctype="multipart/form-data">
            <tr>
                <td nowrap valign="top">Verify string length:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="VerifyLength" value="#form.VerifyLength#" class="textfield" size="4" validate="integer" range="1," required="Yes">
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">Verify characters:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="CharList" value="#form.CharList#" class="textfield" size="80" required="Yes"><br>
                    (String of characters that will be randomly used as Verify string)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">Background color:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="BgColor" value="#form.BgColor#" class="textfield" size="8">
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">List of font face:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="ListFontFace" value="#form.ListFontFace#" class="textfield" size="64"><br>
                    (These are font faces that will be randomly used while generating Verify string)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">List of font size:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="ListFontSize" value="#form.ListFontSize#" class="textfield" size="8"><br>
                    (These are allowable font sizes that will be randomly used while generating Verify string)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">List of font color:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="ListFontColor" value="#form.ListFontColor#" class="textfield" size="32"><br>
                    (These are allowable font colors in hex triplet that will be randomly used while generating Verify string)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">List of font style:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="ListFontStyle" value="#form.ListFontStyle#" class="textfield" size="32"><br>
                    (These are allowable font styles that will be randomly used while generating Verify string)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">Margin:</td>
                <td width="100%" valign="top">
                    Horizontal: <cfinput type="Text" name="HMargin" value="#form.HMargin#" class="textfield" size="4" validate="integer">
                    Vertical: <cfinput type="Text" name="VMargin" value="#form.VMargin#" class="textfield" size="4" validate="integer">
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">Dots density:</td>
                <td width="100%" valign="top">
                    <cfinput type="Text" name="DotDensity" value="#form.DotDensity#" class="textfield" size="4" validate="integer" range="0,10"> (0-10)<br>
                    (0 means no dot will be added to image. Thus makes it more readable to human)
                </td>
            </tr>
            <tr>
                <td nowrap valign="top">Case sensitive:</td>
                <td width="100%" valign="top">
                    <select class="textfield" name="CaseSensitive">
                        <option value="true" #iif(form.Casesensitive is true,de("selected"),de(""))#>True</option>
                        <option value="False" #iif(form.Casesensitive is false,de("selected"),de(""))#>False</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td nowrap valign="top"><strong>Verify image:</strong></td>
                <td width="100%" valign="top">
                    <cftry>
                        <!--- create verify image --->
                        <cfset strDir=GetDirectoryFromPath(ExpandPath("*.*"))>
                        <cfset strVerifyImageFile="#createuuid()#.jpg">
                        <cf_image_Verify  VerifyImageFile="#strDir#/#strVerifyImageFile#"
                                                            HMargin="#form.HMargin#"
                                                            VMargin="#form.VMargin#"
                                                            BgColor="#form.BgColor#" 
                                                            ListFontColor="#form.ListFontColor#"
                                                            ListFontSize="#form.ListFontSize#"
                                                            ListFontStyle="#form.ListFontStyle#"
                                                            ListFontFace="#form.ListFontFace#"
                                                            VerifyLength="#form.VerifyLength#"
                                                            CharList="#form.CharList#"
                                                            CaseSensitive="#form.CaseSensitive#"
                                                            DotDensity="#form.DotDensity#"
                                                            VerifyOut="listVerify">
                                                            
                        <!--- show image and delete when user has load it in their browser --->                                                        
                        <img src="viewimage.cfm?ImageFile=#strVerifyImageFile#" border="0">                
                        <input type="Hidden" name="VerifyHashed" value="#listVerify#">
                        <cfcatch type="Any">
                            An incorrect parameter was supplied: <br>
                            #cfcatch.message#
                        </cfcatch>
                    </cftry>
                </td>
            </tr>
            <tr>
                <td nowrap valign="top"></td>
                <td width="100%" valign="top">
                    <strong><strong>Enter text as shown in image above</strong></strong>
                    <cfinput type="Text" name="VerifyInput" size="32" class="textfield" required="Yes">
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="Submit" value="Update Verify Preferences" class="button" name="submit">
                </td>
            </tr>
        </cfform>
    </table>
    
    <!--- check Verify --->
    <cfif isdefined("form.Submit")>
        <h3>Verify test result:</h3>
        <cfif form.CaseSensitive>
            <cfif listfind(form.VerifyHashed,hash(form.VerifyInput))>
                <cfset strMsg="Verify string matched. User is real human :)">
            <cfelse>
                <cfset strMsg="Verify string doesn't match. User may not be a real human :)">
            </cfif>
        <cfelse>
            <cfif listfindnocase(form.VerifyHashed,hash(lcase(form.VerifyInput)))>
                <cfset strMsg="Verify string matched. User is real human :)">
            <cfelse>
                <cfset strMsg="Verify string doesn't match. User may not be a real human :)">
            </cfif>
        </cfif>
        <h4>#strMsg#</h4>
        <script language="JavaScript">
            alert("Verify test result:\n#jsstringformat(strMsg)#");
        </script>        
    </cfif>
    </cfoutput>
</body>
</html>