I am trying to create an image using 2 different PNG images but I can't get it to work. There are no errors or anything but I didn't get an image created.
Also, is it possible to place some text on the final image and then save it (hardcode text into it)?
Test sample
<?php
$image_1 = imagecreatefrompng('assets/img/image_body.png');
$image_2 = imagecreatefrompng('assets/img/img_2.png');
imagealphablending($image_1, true);
imagesavealpha($image_1, true);
imagecopy($image_1, $image_2, 0, 0, 0, 0, 100, 100);
imagepng($image_1, 'image_3.png');
?>
I changed images location with
$_SERVER['DOCUMENT_ROOT'];
This Code is working.
<?php
// This .php file is inside root>NP
$LOC = $_SERVER['DOCUMENT_ROOT'];
$image_1 = imagecreatefrompng($LOC . '/NP/m1.png');
$image_2 = imagecreatefrompng($LOC . '/NP/m2.png');
imagealphablending($image_1, true);
imagesavealpha($image_1, true);
imagecopy($image_1, $image_2, 0, 0, 0, 0, 640, 400);
imagepng($image_1, $LOC.'/NP/m3.png');
?>