GD function and URL variable

GD function and URL variable

am 04.09.2007 03:38:08 von Nerd Monster

Relative newbie here. I'm sure the solution to this is very simple and I'm
just overlooking
something. I'm using the following code to color an image:

$thishex= 0xFF0000;
$red = imagecolorallocate($im, 0, 0, $thishex);

That works perfect. The problem is, the hex color is coming in the URL
string, without the preceding "0x". To remedy this, I tried:

$hex1 = "0x";
$hex2 = "FF0000";
$thishex = $hex1 . $hex2;
$red = imagecolorallocate($im, 0, 0, $thishex);

This does not work, despite the fact that $thishex echos 0xFF0000. As a
flash
developer, I have run up against this problem before when I don't use strict
data types. As a php newbie, I am not sure that there is a similar
phenomenon in PHP.

Any help is much appreciated!

Re: GD function and URL variable

am 04.09.2007 04:48:56 von Norman Peelman

Nerd Monster wrote:
> Relative newbie here. I'm sure the solution to this is very simple and I'm
> just overlooking
> something. I'm using the following code to color an image:
>
> $thishex= 0xFF0000;
> $red = imagecolorallocate($im, 0, 0, $thishex);
>
> That works perfect. The problem is, the hex color is coming in the URL
> string, without the preceding "0x". To remedy this, I tried:
>
> $hex1 = "0x";
> $hex2 = "FF0000";
> $thishex = $hex1 . $hex2;
> $red = imagecolorallocate($im, 0, 0, $thishex);
>
> This does not work, despite the fact that $thishex echos 0xFF0000. As a
> flash
> developer, I have run up against this problem before when I don't use strict
> data types. As a php newbie, I am not sure that there is a similar
> phenomenon in PHP.
>
> Any help is much appreciated!
>
>
>
>
>
>

Check back in alt.comp.lang.php for the answer. And then there's
something about cross-posting and not multi-posting...

Norm