how to combine two images.
Posted: Sat Jul 12, 2003 1:19 pm
Please excuse me if this post is done incorrectly. This is the php code I will be using to combine two images. Thought maybe someone else would like a copy. See this directory for an example use. The code listed below is referred to as test_02.php & test_02.txt in my testing directory.
Enjoy.
Enjoy.
Code: Select all
<?php
$im = "copyright.png";
$out = "jpg";
$backgroundfile = "back.jpg";
$image_id = imageCreateFromPNG($im);
$im_X = ImageSX($image_id);
$im_Y = ImageSY($image_id);
$backgroundimage = imageCreateFromJPEG($backgroundfile);
imagecopy($backgroundimage, $image_id, 0, 0, 0, 0, $im_X, $im_Y);
Header( "Content-type: image/jpeg");
ImageJPEG($backgroundimage);
ImageDestroy($backgroundimage);
ImageDestroy($image_id);
?>