Luis's Week 14 Example
SLAVE CODE FOLLOWS
<?php
// Create 300x300 canvas
$image = imagecreatetruecolor(300, 300);
// colorss
$colors = [
'background' => imagecolorallocate($image, 253, 245, 230),
'skyblue' => imagecolorallocate($image, 174, 225, 255),
'coral' => imagecolorallocate($image, 255, 160, 122),
'lilac' => imagecolorallocate($image, 206, 170, 230),
'butter' => imagecolorallocate($image, 255, 228, 120),
'charcoal' => imagecolorallocate($image, 80, 80, 80)
];
// BKG
imagefilledrectangle($image, 0, 0, 300, 300, $colors['background']);
// bluee
$diamond = [150, 40, 220, 150, 150, 260, 80, 150];
imagefilledpolygon($image, $diamond, 4, $colors['skyblue']);
// corall
imagefilledrectangle($image, 40, 80, 120, 220, $colors['coral']);
//lilacc
imagefilledellipse($image, 220, 200, 100, 100, $colors['background']);
imagefilledellipse($image, 200, 200, 100, 100, $colors['lilac']);
// butterr
$star = [80,40, 95,70, 130,75, 105,95, 115,130, 80,110, 45,130, 55,95, 30,75, 65,70];
imagefilledpolygon($image, $star, 10, $colors['butter']);
// Liness
imagesetthickness($image, 6);
imageline($image, 0, 150, 300, 150, $colors['charcoal']);
imageline($image, 150, 0, 150, 300, $colors['charcoal']);
// Thick borders only
imagesetthickness($image, 6);
imagerectangle($image, 5, 5, 294, 294, $colors['charcoal']);
// Output as PNG image
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>