Trying to create a colortable - what am I missing here?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've tried to make a color table, but I am missing something. not in the
color-table-code itself, but in somewhere else... I just can't find...

error_reporting is E_ALL, running it on my local server, the script has
512MB to spend, no errors occurs - just something, is wrong.

(4072 * 4072 ~= 255*255*255)

The problem is that the result image only contains all the blue(0,0,0 |
0,0,1 | 0,0,2 ............. 0,0,255) and the rest is black.

I've tried anything, did echo "X{$i % 4072}Y{LONG_Y_CODE}:{$r}-{$g}-{$b}\n";
All seems to be correct, what am I missing here? PHP 5.2.8

$im = imagecreate(4072, 4073);
$white = imagecolorallocate($im, 0, 0, 0);
$r = $g = $b = $i =  0;
$max = 255;
while ($r <= $max) {
    while ($g <= $max) {

        while ($b <= $max) {

            $n = imagecolorallocate($im, $r, $g, $b);
            imagesetpixel($im, ($i % 4072), (($i - ($i % 4072)) / 4072),
$n);


            $i++;
            $b++;
        }
        $b = 0;
        $g++;
    }
    $g = 0;
    $r++;
}
header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);

-- 
Use ROT26 for best security

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux