Isaiah's code for Drawing Text on an Image
You will need a font for this operation -- you can find it here. ✓
Rhast died today: 12/12/2024. Please give a moment to his cuteness.
- If you hve not done so, create a font directory, place the font there, and use this for this project. ✓
- Pick one of your Images. ✓
SLAVE CODE FOLLOWS
<?php // combine two images (i.e., jpg/png) to create a watermark
$name = "Rhast";
// get the images from files
$image = imagecreatefromjpeg("../../images/otherbaby.jpg");
// get sizes
$width = imagesx($image);
$height = imagesy($image);
$font = "../../fonts/arial.ttf";
$cream = imagecolorallocate($image, 255, 253, 208);
// combines the image with text using the following specs
// (image, font-size, angle-rotation, x-coord, y-coord, text-color, font-name, text)
imagettftext($image, 20, 0, 10, $height - 4, $cream, $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);
?>