<?php
$h = @$_REQUEST['h']; $w = @$_REQUEST['w']; $r = @$_REQUEST['r'];
if(!($r && $h > 2*$r && $w > 2*$r))
exit('
<form action=? method=post>
W:<input name=w value=400>
H:<input name=h value=300>
R:<input name=r value=20>
<input type=submit value=Draw>
</form> ');
$w0 = 640; $h0 = 480;
$x0 = ($w0-$w)>>1;
$y0 = ($h0-$h)>>1;
$x3 = $x0+$w-1;
$y3 = $y0+$h-1;
$x1 = $x0+$r;
$y1 = $y0+$r;
$x2 = $x3-$r;
$y2 = $y3-$r;
$im = imagecreate($w0, $h0);
$a = imagecolorallocate($im, 50, 50, 50);
$b = imagecolorallocate($im, 250, 250, 250);
imagefill($im, 1, 1, $a);
imagefilledrectangle($im, $x0, $y0, $x3, $y3, $b);
imagefilledrectangle($im, $x0, $y0, $x1, $y1, $a);
imagefilledarc($im, $x1, $y1, $r*2, $r*2, -180, -90, $b, IMG_ARC_PIE);
imagefilledrectangle($im, $x0, $y2, $x1, $y3, $a);
imagefilledarc($im, $x1, $y2, $r*2, $r*2, 90, 180, $b, IMG_ARC_PIE);
imagefilledrectangle($im, $x2, $y0, $x3, $y1, $a);
imagefilledarc($im, $x2, $y1, $r*2, $r*2, -90, 0, $b, IMG_ARC_PIE);
imagefilledrectangle($im, $x2, $y2, $x3, $y3, $a);
imagefilledarc($im, $x2, $y2, $r*2, $r*2, 0, 90, $b, IMG_ARC_PIE);
imagestring($im, 8, $x1, $y1, 'It looks like a label', $a);
imagegif($im);
?>
|