そこでphp関数を使用して画像を作成していますimagesetpixel()
が、開始x位置とy位置を設定できますが、コード内にある場合:
for ($i=1;$i<50;$i++)
{
for ($a=1;$a<50;$a++)
{
imagesetpixel($img, $i, $a, $color);
}
}
これはすべてのフィールド1x1pxを作成しますが、おそらく5x5pxが必要です。そのようなものを作ることは可能ですか?
以下のURLを参照してください:-
http://phptutorial.info/?imagesetpixel
http://php.net/manual/en/function.imagesetpixel.php
例:-
<?php
$x = 200;
$y = 200;
$gd = imagecreatetruecolor($x, $y);
$corners[0] = array('x' => 100, 'y' => 10);
$corners[1] = array('x' => 0, 'y' => 190);
$corners[2] = array('x' => 200, 'y' => 190);
$red = imagecolorallocate($gd, 255, 0, 0);
for ($i = 0; $i < 100000; $i++) {
imagesetpixel($gd, round($x),round($y), $red);
$a = rand(0, 2);
$x = ($x + $corners[$a]['x']) / 2;
$y = ($y + $corners[$a]['y']) / 2;
}
header('Content-Type: image/png');
imagepng($gd);
?>
-たとえば[imagecreate][1]関数に引数として渡す必要のある画像のサイズ。
例:
$width = 5;
$height = 5;
$img = imagecreate($width, $height);