Skip to main content
Known Participant
October 16, 2008
Question

imageDrawText alignment

  • October 16, 2008
  • 2 replies
  • 911 views
I'm really struggling with the functionality of imageDrawText. I'd like to be able to do two things:

1. Is there any way to make the text align right or center?

2. I'd like to create a text string, get it's exact length and then paste it onto an image.

Any help would be appreciated.

This topic has been closed for replies.

2 replies

Inspiring
October 16, 2008
leecrock wrote:
> 1. Is there any way to make the text align right or center?
> 2. I'd like to create a text string, get it's exact length and then paste it onto an image.

That is not really something you can do with imageDrawText. You can use this method to get the size of the graphical text. Then use those dimensions to center or right align the text.
http://www.coldfusionjedi.com/index.cfm/2008/1/16/ColdFusion-8-Image-functions-and-text-size

Bear in mind the measurements are not always pixel perfect. When using italics or certain fonts, the size may be off by a few pixels occasionally . But they should be good enough for most purposes.
Inspiring
October 16, 2008
sounds like a perfect job for imageUtils cfc from Ray Camden/Ben Nadel:
http://imageutils.riaforge.org/


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Known Participant
October 21, 2008
Perfect. Yes the imageutils solved the problem. Thanks for your help