mercredi 30 novembre 2016

How to Create a new image from three images in PHP or using other web languages?

I have three images. 1.Backgroundimage.jpg , 2.image1.jpg ,3.image2.jpg

Backgroundimage size 400*400

image1 100*100

image2 100*100

I need to place the image1 and image2 on the Backgroundimage in php?

My php file have some contents so if I am using header('Content-type':'image/jpg'),it is showing empty page. Now to show that Edited image(final image) in my PHP file?

I am tried add two images: code:

<?php  
$img1= imagecreatefromjpeg('image1.png');
$img2 = imagecreatefromjpeg('image2.jpg');

imagealphablending($img2 , false);
imagesavealpha($img2 , true);

imagecopymerge($img2 , $img1 , 10, 9, 0, 0, 181, 180, 100); 

header('Content-Type: image/jpeg'); // If i am using that line it is showing empty page otherwise the image displayed in ASCII value
imagepng($img2);

imagedestroy($img2);
imagedestroy($img1);
?>




Aucun commentaire:

Enregistrer un commentaire