Draws a text string on a ColdFusion image with the baseline of the first character positioned at (x,y) in the image.
imageDrawText(name, str, x, y, attributecollection)
→ returns void
someImage.drawText(str, x, y, attributecollection)
This example shows how to create a text string image.
<!--- Use the imageNew function to create a 200x100-pixel image. --->
<cfset myImage=imageNew("",200,100)>
<!--- Set the drawing color to green. --->
<cfset imageSetDrawingColor(myImage,"green")>
<!--- Specify the text string and the start point for the text. --->
<cfset imageDrawText(myImage,"It's not easy being green.",10,50)>
<!--- Display the image in a browser. --->
<cfimage source="#myImage#" action="writeToBrowser">
CF 11+ Lucee 4.5+ Create a new image. With the new image write "CFDocs" with the text characteristics specified
TextCharacteristics = { size="20", style="bold", strikethrough="false", underline="false"};
imgObj = imageNew("",152,152,"rgb","149c82");
imgObj.drawText("CFDocs",20,50,TextCharacteristics);
cfimage (action="writeToBrowser", source=imgObj);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.