PHP/Graphics Image/imagecreatefromjpeg
Creating an Image from an Existing Image
Loading an Existing Image
<?php
$animage = imagecreatefromjpeg ("myImage.jpg");
imagejpeg ($animage);
header ("Content-type: image/jpeg");
imagedestroy ($animage);
?>
Saving and Outputting the Modified Image
<?php
$animage = imagecreatefromjpeg ("myImage.jpg");
$black = imagecolorallocate ($animage, 0, 0, 0);
$topleftx = 10;
$toplefty = 40;
$bottomrightx = 700;
$bottomrighty = 90;
$strlen = (strlen ($_GET["whattosay"]) * imagefontwidth (5));
$xcoord = (((($bottomrightx - $topleftx) - $strlen) / 2) + $topleftx);
imagestring($animage, 5, $xcoord, 50, $_GET["whattosay"], $black);
imagejpeg ($animage);
header ("Content-type: image/jpeg");
imagejpeg ($animage,"savedimages/" . time() . ".jpg");
imagedestroy ($animage);
?>