Thursday 28 May 2009

Merging String with the image in php


header("Content-type: image/jpeg");
$string = "jothirajafgjhvdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsdsg
sdgdsgdsgdsgdsg";
$im = imagecreatefromjpeg("butterfly.jpg");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 40.5 * strlen($string)) / 100;
imagestring($im, 3, $px, 380, $string, $orange);
imagejpeg($im);
$jothirajan_a= "IMAGE_".date('d').time().".jpg";
imagejpeg ($im,"image/".$jothirajan_a."");
imagedestroy($im);
?>

Merging images in php

$imgStop = imagecreatefromjpeg("AAKX001003.jpg"); /* Attempt to open */


$imgThumb = imagecreatefromjpeg("AXR001600.jpg");


imagecopy($imgThumb,$imgStop,0,450,0,0,480,50);


header("Content-type: image/jpeg");
imagejpeg($imgThumb);


$jothirajan_a= "IMAGE_".date('d').time().".jpg";
imagejpeg ($imgThumb,"image/".$jothirajan_a."");
imagedestroy($imgThumb);

?>

Image to image merging in php

>>> Create folder called image/

This is my code
$imgStop = imagecreatefromjpeg("AAKX001003.jpg"); /* Attempt to open */

$imgThumb = imagecreatefromjpeg("AXR001600.jpg");

imagecopy($imgThumb,$imgStop,0,450,0,0,480,50);

header("Content-type: image/jpeg");

imagejpeg($imgThumb);

$jothirajan_a= "IMAGE_".date('d').time().".jpg";

imagejpeg ($imgThumb,"image/".$jothirajan_a."");

imagedestroy($imgThumb);

?>