Reply to Font color in jpeg image (nearly) always orange

Your name:

Reply:


Posted by spgedwards on 10/11/06 10:58

I am trying to run a basic script that displays an existing jpeg image
and writes some text over it. Sounds simple, but I cannot seem to be
able to colour the font correctly. In the example below it should be
black but it comes out orange. In fact, even if I change the colour to
0, 0, 255 it's orange.

I've read in the PHP documentation (the user contributed notes) that
there are issues with jpeg font colouring. But I've not seen any
details. Can anyone shed light on this for me please?

The example code below is called as a function. The $image variable is
a path to the existing image file and the $ttf variable is a path to a
TrueType font. The $text variable contains a text string.

header("Content-type: image/jpeg");
$base_image = imagecreatefromjpeg($image);
$font = $ttf;
$fontcolor = imagecolorallocate($base_image, 0, 0, 0);
imagettftext($base_image, 18, 0, 10, 100, $fontcolor, $font, $text);
imagejpeg($base_image); imagedestroy($base_image);

Cheers,
Si.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация