Re: colored text in images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcus Gnaß wrote:

Hi list!

I like to generate a larger image from different tiles.
Each tile should have a text on it which should be
red for better readability. I figured out how to
compose the larger image but got stuck when
to color the text. I tried the following code:

$img = imagecreate($w * 100, $h * 100);
$tile = imagecreatefromgif($tile_name);




$red = imagecolorallocate($tile, 255, 0, 0);
imagestring($tile, $font, $gebilde_x, $gebilde_y, $gebilde, $rot);



Because PHP doesn't grok that $red==$rot, and I'm not
sure that it is, either?  What happens when you use $red
in the imagestring() call?


imagecopy($map, $tile, $dst_x, $dst_y, 0, 0, imagesx($tile), imagesy($tile));
header("Content-Type: image/gif");
imagegif($map);

The text was writte an expected, just it was grey and not
red. What do I have to do to make it read and why was it grey?


Hopefully, you caught that above.  The 6th parameter of
imagestring should be an integer to represent the color.

HTH,

Kevin Kinsey

--
You will hear good news from one you thought unfriendly to you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux