Evan's code for Draw a Polygon (lines and square)
SLAVE CODE FOLLOWS
<?php
include('includes/header.php');
error_reporting(E_ALL);
// --- Create image and save to file ---
$image = imagecreate(400, 300);
$bg = imagecolorallocate($image, 238, 238, 238);
$blue = imagecolorallocate($image, 0, 0, 255);
$triangle = array(10,20, 100,200, 300,200 );
$pts = count($triangle)/2;
imagefilledpolygon($image, $triangle, $pts, $blue);
$red = imagecolorallocate($image, 255, 0, 0);
$frame = array(0,0 , 399,0 , 399,299 , 0,299);
imagepolygon($image, $frame, count($frame)/2, $red);
// save image to file
$filename = 'polygon_temp.png';
imagepng($image, $filename);
imagedestroy($image);
?>
<h1>Evan's code for Draw a Polygon (lines and square)</h1>
<!-- Display the generated image -->
<img src="<?php echo $filename; ?>" alt="polygon">
<hr><br>SLAVE CODE FOLLOWS<br><br>
<!-- Show this file's source code -->
<?php highlight_file(__FILE__); ?>
<?php include('includes/footer.php'); ?>