Adobe ColdFusion 8

Example

On the first form page, create a query that selects the artwork from the cfartgallery database and displays the titles in a pop-up menu:

<!--- Create a query to extract artwork from the cfartgallery database. --->
<cfquery name="artwork" datasource="cfartgallery">
SELECT ARTID, ARTNAME, LARGEIMAGE
FROM ART
ORDER BY ARTNAME
</cfquery>

<!--- Create a form that lists the artwork titles generated by the query. Set the value to
    LARGEIMAGE so that the image file is passed to the action page. --->
<cfform action="dupImage2.cfm" method="post">
<p>Please choose a title:</p>
<cfselect name="art" query="artwork" display="ARTNAME" value="LARGEIMAGE" required="yes"
    multiple="no" size="8">
</cfselect>
<br/><cfinput type="submit" name="submit" value="OK">
</cfform>

On the first action page, clone the original image three times, change the sharpness setting for each clone, and display the results:

<!--- Determine whether a valid image file exists. --->
<cfif IsImageFile("../cfdocs/images/artgallery/#form.art#")>
    <cfset original=ImageNew("../cfdocs/images/artgallery/#form.art#")>
    <!--- Use the ImageNew function to create a clone of the ColdFusion image. --->
    <cfset clone1=ImageNew(original)>
    <!--- Use the ImageSharpen function to blur the cloned image. --->
    <cfset ImageSharpen(clone1,-1)>
    <!--- Use the ImageNew function to create a second clone of the original image. --->
    <cfset clone2=ImageNew(original)>
    <!--- Use the ImageSharpen function to sharpen the cloned image. --->
    <cfset ImageSharpen(clone2,1)>
    <!--- Use the ImageNew function to create a third clone for the original image. --->
    <cfset clone3=ImageNew(original)>
    <!--- Use the ImageSharpen function to sharpen the cloned image to the maximum setting.
        --->
    <cfset ImageSharpen(clone3,2)>
<!--- Create a form with a radio button for each selection. The value of the hidden field
    is the relative pathname of the original image file. --->
<p>Please choose an image:</p>
<table>
    <tr>
    <cfform action="dupImage3.cfm" method="post">
        <td><cfimage source="#original#" action="writeToBrowser"><br />
        <cfinput type="radio" name="foo" value="original">Original Image</td>
        <td><cfimage source="#clone1#" action="writeToBrowser"><br />
        <cfinput type="radio" name="foo" value="blurred">Blurred Image</td>
        <td><cfimage source="#clone2#" action="writeToBrowser"><br />
        <cfinput type="radio" name="foo" value="sharper">Sharper Image</td>
        <td><cfimage source="#clone3#" action="writeToBrowser"><br />
        <cfinput type="radio" name="foo" value="sharpest">Sharpest Image</td>
        <tr><td><cfinput type="Submit" name="OK" value="OK">
        <cfinput type="hidden" name="orig_file"
            value="../cfdocs/images/artgallery/#form.art#">
        </td></tr>
    </cfform>
    </tr>
</table>
<cfelse>
    <p>There is no image associated with the title you selected. Please click the Back button
        and try again.</p>
</cfif>

On the second action page, save the selected image to the C drive:

<p>The image you have chosen has been saved.</p>
<cfset img=ImageNew("#form.orig_file#")>
<cfswitch expression=#form.foo#>
    <cfcase value="blurred">
        <cfset ImageSharpen(img,-1)>
    </cfcase>
    <cfcase value="sharper">
        <cfset ImageSharpen(img,1)>
    </cfcase>
    <cfcase value="sharpest">
        <cfset ImageSharpen(img,2)>
    </cfcase>    
</cfswitch>

<!--- Use the cfimage tag to write the image selected from the form to a file in the C drive.
    Use the value of the form's hidden field as the source file for the image. --->
<cfimage source="#img#" action="write" destination="c:/myImage.jpg" overwrite="yes">
<img src="c:/myImage.jpg" />