Allie's Week 14 Example
SLAVE CODE FOLLOWS
<?php
// Create a blank canvas (300x300)
$image = imagecreatetruecolor(300, 300);
// Define colors
$background = imagecolorallocate($image, 250, 250, 255); // light pastel blue
$mint = imagecolorallocate($image, 170, 240, 209);
$peach = imagecolorallocate($image, 255, 204, 188);
$lavender = imagecolorallocate($image, 218, 187, 255);
$rose = imagecolorallocate($image, 255, 174, 201);
$gray = imagecolorallocate($image, 120, 120, 120);
// Fill background
imagefilledrectangle($image, 0, 0, 300, 300, $background);
// Draw shapes
// Rectangle with peach color
imagefilledrectangle($image, 30, 30, 120, 90, $peach);
// Ellipse with mint green
imagefilledellipse($image, 220, 70, 80, 50, $mint);
// Triangle (lavender)
$triangle = [
150, 200,
100, 250,
200, 250
];
imagefilledpolygon($image, $triangle, 3, $lavender);
// Circle (rose)
imagefilledellipse($image, 80, 200, 50, 50, $rose);
// Smooth line (gray)
imageline($image, 0, 0, 300, 300, $gray);
imageline($image, 300, 0, 0, 300, $gray);
// frame border
imagerectangle($image, 0, 0, 299, 299, $gray);
// Output
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>