Akhil Sahu Akhil Sahu - 9 months ago 54
PHP Question

Merge two image created using php

How can i merge two image created from url two url like:

Merge these two images:



Not same as the possible duplicate: Image not fetched


To merge two images like shown here and assuming that images are in png .You might need to use following code:

$dest = imagecreatefrompng($url1);
$src = imagecreatefrompng($url2);
imagecopymerge($dest, $src, 0, 0, 0, 0, 500, 100, 90);

The following can be used to output image to browser

header('Content-Type: image/png');