I'm trying to overlap a transparent png image over another png. I followed other answers but I didn't manage to solve my problem. Here it is what I've done so far:
header("Content-type: image/png");
$im = imagecreatefrompng("image/orange.png");
$trans_background = imagecolorallocate($im, 0, 0, 0, 127);
$logo = imagecreatefrompng($data["badgeUrls"]["medium"]);
imagesavealpha($logo, true);
imagefill($logo, 0, 0, $trans_background);
imagecopy($im, $logo, 100, 100, 0, 0, 200, 200);
imagepng($im);
imagedestroy($logo);
imagedestroy($im);
and this is the result: result
EDIT: logo.png it's transparent. If I try this code on html using the same link, it works:
<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">
<img src="https://api-assets.clashofclans.com/badges/200/lTvtX122PSoz5wXzrzp5mFlw0y-72zVviKvuy9cXOFs.png">
</body>
</html>
Result 2: pic