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

From: Date: Sat, 09 May 2009 19:00:15 +0000
Subject: Trying to create a colortable - what am I missing here?
Groups: php.general 
Request: Send a blank email to php-general+get-292429@lists.php.net to get a copy of this message
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

« previous php.general (#292429) next »