Home » Php » html – How to add png image on image in Php Gd library

html – How to add png image on image in Php Gd library

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am trying to add image on image in PHP Gd library but the upper PNG image is making problems. The Picture is Cropping and also appearing with background.

<?php
// Define File Type
header('content-type: image/png');

// Collect Source And Data
$source = "male-fav.png";

// Set Background Image
$image = imagecreatefrompng($source);
$src = imagecreatefrompng('fav.png');

// Copy and merge
imagecopymergegray($image, $src, 0, 0, 0, 0, 50, 50, 100);


// Final Image Create
imagepng($image);
?>

to see the problem see this link: https://chic-ken.world/images/fev/fev.php

How to&Answers: