imagefilledrectangle

Hy.
I’m very noob in php (just started), and i vas trying to learn from an online book but i got stuck.
Can someone tell me why i don’t get the same image as it show on this url: http://www.tuxradar.com/practicalphp/11/2/3
from the code above the image ?? :frowning:

thank you.

[php]<?php
$image = imagecreate(400,300);
$gold = imagecolorallocate($image, 255, 240, 00);
$white = imagecolorallocate($image, 255, 255, 255);
$colour = $white;

for ($i = 400, $j = 300; $i > 0; ($i -= 4), ($j -= 3)) {
    if ($colour == $white) {
        $colour = $gold;
    } else {
        $colour = $white;
    }

    imagefilledrectangle($image, 3, 300 - $j, $i, $j, $colour);
	
}
imagepng($image, 'imagefilledrectangle.png');
imagedestroy($image);

?>
[/php]

For some reason its being covered?
I dunno why its doing it but setting 400 - $i to 3 works

same if u set 400-$i to 0…but it’s not the original picture it’s look like it but with some diferences.

Sponsor our Newsletter | Privacy Policy | Terms of Service