Evan's code for Draw a Polygon (lines and square)

polygon

SLAVE CODE FOLLOWS

<?php
include('includes/header.php');
error_reporting(E_ALL);

// --- Create image and save to file ---
$image imagecreate(400300);
$bg imagecolorallocate($image238238238);
$blue imagecolorallocate($image00255);
$triangle = array(10,20100,200300,200 );
$pts count($triangle)/2;
imagefilledpolygon($image$triangle$pts$blue);
$red imagecolorallocate($image25500);
$frame = array(0,399,399,299 0,299);
imagepolygon($image$framecount($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'); ?>