Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Watermark font always black

images php coding issues or problems here.

Moderators: macek, egami, gesf

Watermark font always black

Postby DigitalRice » Thu Oct 16, 2003 3:15 pm

hi. i'm trying to put a watermark font on my picture, but the font always black, how come? i want different font's color, canyou help?

Code: Select all

    $img = imagecreate($width,$height);        //size of text image
   $white = imagecolorallocate($img, 255,0,255);  //no mater how this value are, it still black.

    $waterMarkText = "watermark testing";

    $ttf = $_SERVER['DOCUMENT_ROOT'] . "/font/timesbd.ttf";
     imagettftext($photoImage, 12, 0, $horizmargin, $vertmargin, $white, $ttf, $waterMarkText);

$white = imagecolorallocate($img, 255,0,255); //no mater how this value are, it still black.

New php-forum User
New php-forum User
Posts: 29
Joined: Fri Jun 27, 2003 10:05 pm

Postby Oleg Butuzov » Fri Oct 17, 2003 6:10 am

really wired......

post a full code of image wotermarks
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby pootergeist » Sat Oct 18, 2003 11:33 am

you MUST allocate the colour to the same image as you are writing to

$white = imagecolorallocate($img, 255,0,255);
// defines an index as white for image pointer $img

imagettftext($photoImage, 12, 0, $horizmargin, $vertmargin, $white, $ttf, $waterMarkText);
// writes string to image with pointer $photoImage
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.