Reputation: 13
Im using php code to merge user image on png background. Here below is code i am use.
$width = 140;
$height = 140;
$bottom_image = imagecreatefrompng("bg.png");
$top_image = imagecreatefromjpeg("default.jpg");
imagesavealpha($top_image, true);
imagealphablending($top_image, false);
imagecopyresampled($bottom_image, $top_image, 290, 125, 0, 0, $width, $height, $width, $height);
//imagecopy($bottom_image, $top_image, 290, 125, 0, 0, $width, $height);
header('Content-type: image/png');
imagepng($bottom_image);
but i got this result when i save image
i want user image in round circle back.
Upvotes: 1
Views: 1191
Reputation: 27585
You are copying a JPEG image over the background image.
JPEG doesn't support transparency.
What you could do with the gd library is:
Upvotes: 1