Thank you to Dan Z. for the following information:
ASPImage is also compatible with Cold Fusion 4.0 or later.To make it work you use the <CFObject> tag and then us a <CFSET> tags to communicate to the ASPImage COM object.
Here's a simple CF example:
<!--- Create AspImage Object --->
<cfobject type="COM"
name="Image"
class="AspImage.Image"
action="CREATE">
<!--- Setup Basic Settings --->
<cfset Image.FontColor = 427140>
<cfset Image.ThreeDColor = 195100092>
<cfset Image.Italic = True>
<cfset Image.Bold = True>
<cfset Image.FontName = "Arial">
<cfset Image.FontSize = 32>
<cfset Image.PadSize = 0>
<cfset Image.JPEGQuality = RandRange(60,80)>
<!--- Setup Image Size --->
<cfset Image.MaxX =370><!-- Width -->
<cfset Image.MaxY = 130> <!-- Height -->
<!--- Setup text --->
<cfparam name="Line1" default="Line One"> <!--- First Line --->
<cfparam name="Line2" default="Line two"> <!--- Second Line --->
<!--- Setup Path to Image --->
<cfset Fn ="E:\web\beta\BlankBanner.jpg"> <!--- Path to blank Banner --->
<!--- Add The Image--->
<cfset Image.AddImage(Fn,0,0)> <!--- This differs from VB /ASP code it follows the Object.Method(Args)--->
!-- Center Twoline of text over banner -->
<cfset TextXPos = Image.MaxX - (Image.TextWidth(Line1)+10)>
<cfset TextXPos = TextXPos/2>
<cfset Text2XPos = Image.MaxX - (Image.TextWidth(Line2)+10)>
<cfset Text2XPos = Text2XPos/2>
<cfset TextYPos = Image.TextHeight(Line1)/3>
<cfset Text2YPos = Image.TextHeight(Line2)/3>
<!--- Output the text--->
<cfset Image.TextOut(Line1,TextXPos,TextYPos-25,1)>
<cfset Image.TextOut(Line2,Text2XPos,Text2YPos+25,1)>
<cfset Image.FileName = "E:\web\beta\banner.jpg">
<cfset Image.SaveImage()>
<!--- Display The Image--->
<IMG id="Banner" HEIGHT="130" WIDTH="350" SRC="http://localhost/beta/banner.jpg" BORDER="0" ALT="<cfoutput> #Line1# #Line2#</cfoutput>">
*************************************************************
Overcoming Caching Problems:
I found the most reliable workaround is to use a random number range for the value of the
Image.JPEGQuality. This randomly changes the actual file size, thus the browser thinks it's a new image each time.
Example:
<CFSET Image.JPEGQuality = RandRange(60,100)>