<?php
function NewColor() {
$color = "";
$array = array(
mt_rand(0,15),
mt_rand(0,15),
mt_rand(0,15),
mt_rand(0,15),
mt_rand(0,15),
mt_rand(0,15),
);
foreach ($array as $key => $value) {
switch ($value) {
case 10:
$color .= 'a';
break;
case 11:
$color .= 'b';
break;
case 12:
$color .= 'c';
break;
case 13:
$color .= 'd';
break;
case 14:
$color .= 'e';
break;
case 15:
$color .= 'f';
break;
default:
$color .= $value;
break;
}
}
return $color;
}
$width = 101;
$height = 101;
$image = @imagecreate($width, $height) or die('Cannot initialize GD!');
$y = 1;
while ($y !=$height) {
$x = 1;
while ($x != $width) {
$rgb = NewColor();
$r = intval(substr($rgb, 0, 2));
$g = intval(substr($rgb, 2, 2));
$b = intval(substr($rgb, 4, 2));
imagesetpixel($image, $x, $y, imagecolorallocate($image, $r, $g, $b));
//echo("<p>".$x." - ".$y."</p>");
//imagesetpixel($image, $x, $y, imagecolorallocate($image, mt_rand(0,255), mt_rand(0,255), mt_rand(0,255)));
$x++;
}
$y++;
}
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
?> This produces this:

Whereas it SHOULD be random pixels all over?