<?php
$w=150;
$h=150;
$cols=4;
$im = imageCreate($w,$h);
$del=1.5;
$mw = $w/$del; $mh = $h/$del;
$c = imageColorAllocate($im, 245, 245, 245);
imagefilledrectangle($im, 0, 0, $w, $h, $c);
$c = array(rand(0,200),rand(0,200),rand(0,200));
for($zz=0;$zz<5;$zz++)
{
$im = createPolgon($im, $w, $h, $mw, $mh,5, $c, 75);
}
header('Content-type: image/jpg');
imagepng($im);
imagedestroy($im);
function createPolgon($image, $width, $height, $mwidth, $mheight, $count, $color, $merge)
{
$img = imageCreate($width,$height);
$c = imageColorAllocate($img, 245, 245, 245);
imagefilledrectangle($img, 0, 0, $width, $height, $c);
for($i=0;$i<$count;$i++)
{
$c = imageColorAllocate($image,$color[0],$color[1],$color[2]);
$cnt=3;
$values=array(rand(0,$mwidth), rand(0,$mheight),rand(0,$mwidth), rand(0,$mheight),rand(0,$mwidth), rand(0,$mheight));
imagefilledpolygon($image, $values, $cnt, $c);
}
$rotate = imagerotate($image, 90, 0);
imagecopymerge($image, $rotate, 0, 0, 0, 0, $width, $height, 50);
$rotate = imagerotate($image, 180, 0);
imagecopymerge($image, $rotate, 0, 0, 0, 0, $width, $height, 50);
imagecopymerge($img, $image, 0, 0, 0, 0, $width, $height, $merge);
return $img;
}
preferences:
28.08 ms | 402 KiB | 5 Q