Jenna's code for Drawing Text on an Image

Image Text

You will need a font for this operation -- you can find it here.

Here's the assignment.



SLAVE CODE FOLLOWS

<?php // add text to an image

$name "Jenna";

// get the images from files
$image imagecreatefromjpeg("museumofillusions.jpg");

//get sizes
$width imagesx($image);
$height imagesy($image);

$font 'fonts/arial.ttf';

// sets the current foreground color to RGB (255, 255, 255), which is WHITE
$white imagecolorallocate($image255255255);

// combines the image with text using the following specs
// (image, font-size, angle-rotation, x-coord, y-coord, text-color, font-name, text)

imagettftext($image20010$height 4$white$font$name);

//=== display the image

// tell the server that a PNG image  follows
header("Content-type: image/png");

// display the image
imagepng($image);

// destroy the image (i.e., release memory)
imagedestroy ($image);
?>