To change your Image color use ImageFill:


Then, in your ImageTTFText, you can set the font:

ImageTTFText($im, 11, 0, 20, (540-20),-$black,"../fonts/arial.ttf", "Source:
SEER 12 Program");
I recommend using -$fontcolor for almost everything.  Sometimes it's not as
good for the larger fonts (they look a little stairsteppy) but it's almost
always better for the smaller fonts.

Good luck!


-----Original Message-----
From: Ziying Sherwin [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 28, 2002 10:59 AM
Subject: [PHP] imagettftext question

In our application, we need to write a UTF8 strings to the image using True 
Type fonts. The php function that we are using is imagettftext. However, we
have the two problems regarding that function:

1. The images that are generated by this function is white fonts on the
   background. But what we want is black fonts on the white background. It 
   seems impossible to set the background color. What we are doing now is to
   call external commands to reverse the color which is rather slow. Is
   better way to achieve the same result?

2. We also have long UTF8 stings that need to be broken into several lines. 
   Which php function has the ability to properly break UTF8 strings? And
   how to display multiple lines using imagettftext?

Ziying Sherwin

P.S. I am not on the mailing list, please reply to [EMAIL PROTECTED]

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to