How can I place a transparent image to a background image using PHP?
I have here my code:
$width = 400;
$height = 400;
$base_image = imagecreatefrompng("img/frame1.png");
$top_image = imagecreatefrompng("randyorton.png");
$merged_image = "merged.png";
imagealphablending($base_image, true);
imagesavealpha($base_image, true);
imagealphablending($top_image, true);
imagesavealpha($top_image, true);
imagecopy($base_image, $top_image, 10080, 10080, 0, 0, $width, $height);
imagecopy($base_image, $top_image, 80, 80, 0, 0, $width, $height);
header('Content-Type: image/png');
imagepng($base_image, $merged_image);
What's wrong with this? The image I am creating now has a black background on it.
Please see this picture for reference:
Am I making sense?
Thanks!