Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 939

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<!--- 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 processing page. --->
<cfform action="addWatermarkB.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>
The action page generates a ColdFusion image from the selected file by using the
function resizes the image and applies the bicubic interpolation method to improve the resolution. To use the
manipulated image as a watermark, specify the image variable, as the following example shows:
<!--- Verify that an image file exists and is in a valid format. --->
<cfif IsImageFile("../cfdocs/images/artgallery/#form.art#")>
<!--- Use the cfimage tag to create a ColdFusion image from the file chosen from the list. --->
<cfimage source="../cfdocs/images/artgallery/#form.art#" action="read" name="myWatermark">
<!--- Use the ImageScaleToFit function to resize the image by using the bicubic interpolation
method for better resolution. --->
<cfset ImageScaleToFit(myWatermark,450,450,"bicubic")>
<!--- Use the ColdFusion image variable as the watermark in a PDF document. --->
<cfpdf action="addWatermark" source="title.pdf" image="#myWatermark#"
destination="watermarkTitle.pdf" overwrite="yes">
<cfelse>
<p>I'm sorry, no image exists for that title. Please click the Back button and try
again.</p>
</cfif>
For more information on ColdFusion images, see
Creating a text image and using it as a watermark
You can use the
ImageDrawText
as the following example shows:
"Creating and Manipulating ColdFusion
function to create a text image in ColdFusion and apply the image as a watermark,
Last updated 1/20/2012
tag. The
cfimage
ImageScaleToFit
Images" on page 959.
934

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents