RE: [PHP] ImageColorAllocate() Problem
From: Martin Towell (martin.towell_at_world.net)
Date: 10/03/03
- Next message: Jed R. Brubaker: "Re: undefined function imagecreate()"
- Previous message: Tom Rogers: "Re[2]: [PHP] unexpected results using sprintf() with %u"
- Next in thread: Jed R. Brubaker: "Re: [PHP] ImageColorAllocate() Problem"
- Reply: Jed R. Brubaker: "Re: [PHP] ImageColorAllocate() Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "'Jed R. Brubaker'" <jed.brubaker@psych.utah.edu>, php-general@lists.php.net Date: Fri, 3 Oct 2003 16:28:40 +1000
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:jed.brubaker@psych.utah.edu]
Sent: Friday, 3 October 2003 4:23 PM
To: php-general@lists.php.net
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
- Next message: Jed R. Brubaker: "Re: undefined function imagecreate()"
- Previous message: Tom Rogers: "Re[2]: [PHP] unexpected results using sprintf() with %u"
- Next in thread: Jed R. Brubaker: "Re: [PHP] ImageColorAllocate() Problem"
- Reply: Jed R. Brubaker: "Re: [PHP] ImageColorAllocate() Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|