Create text on image in center using coldfusion imageDrawText

Using imageSetDrawingColor, imageDrawText, imageNew, writeToBrowser, coldfusion, structNew, Create text image in image center.

<cfset text = "P">
<cfset imageWidth = 100 />
<cfset imageHeight = 100 />
<cfset txtWidth = 30 />
<cfset txtHeight = txtWidth />

<cfset textImg = imageNew("",imageWidth,imageHeight,"rgb","red")>
<cfset x=max(textImg.width,textImg.height)>
<cfset newheight=textImg.height*txtHeight/x>
<cfset newwidth=textImg.width*txtWidth/x>

<cfset newx = (textImg.width/2 - newwidth/2)>
<cfset newy = (textImg.height/2 + newheight/2)>

<cfset texAttr = StructNew()>
<cfset texAttr.font="Arial">
<cfset texAttr.size = txtWidth>
<cfset texAttr.style = "bolditalic">
 
............
............
............
 
More details Visit -
https://www.elearn99.com/programming/create-text-image-center-imagedrawtext/253/ 

Comments

Popular posts from this blog

Login with facebook using coldfusion

Create CSV file in Coldfusion Using CFFile

Get Previous One Day Data in Sql Server