Thursday, June 7, 2012

Turning an email address into an image using ColdFusion ( Railo 3.3 )

I've come across the need to be able to render text in a browser (specifically, in this case an email address) that is not easily robot-readable, and is painless to show inline in the browser.

<cfset request.newImage = imageNew("",250,15,"rgb","white")>
 <cfset request.textRow1="">
 <cfset attr = { font="SansSerif.plain", size="12", style="bold"}>
 <cfset imageSetDrawingColor(request.newImage,"black")>
 <cfset imageDrawText(request.newImage, request.textRow1, 0, 10, attr)>

 <cfimage action = "writeToBrowser"
   source = "#request.newImage#"  

Thanks to:

No comments: