Saving and Outputting the Modified Image : imagecreatefromjpeg « Graphics Image « PHP






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); 

?>
  
  








Related examples in the same category

1.Creating an Image from an Existing Image