I think it might be because you're passing a string to the function instead
of a hex value...

try changing it to this and see if it works

$color = ImageColorAllocate($im, hexdec($hex1), hexdec($hex2),
hexdec($hex3));

HTH
Martin

-----Original Message-----
From: Jed R. Brubaker [mailto:[EMAIL PROTECTED]
Sent: Friday, 3 October 2003 4:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] ImageColorAllocate() Problem


I am having a bizzare problem with the imagecolorallocate() function. Maybe
all of you can help me!

Here is the code:

$hex1 = "0x".$color{0}.$color{1};
$hex2 = "0x".$color{2}.$color{3};
$hex3 = "0x".$color{4}.$color{5};

$color = ImageColorAllocate($im, $hex1, $hex2, $hex3);

Simple enough! $color starts off as a hex color code minus the #, and then
is pulled into each of the 3 alpha values by way for the hex variables. It
is later outputted in text:

ImageTTFText ($im, $cursive_size, 0, $text1_x, $text1_y, $color, $font1,
$cursive_text);

Problem: The text is always black.
Something strange: If I just type in a randomly selected color, it works!

Is there some reason that the values in my variables wouldn't be passing?

Thanks in advance,
Jed R. Brubaker

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ Information from NOD32 1.518 (20030925) __________

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com

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

Reply via email to