Почему через прозрачность не видно фонового изображения и как сделать, чтобы было видно?
Сама функция:
function joinImages($background, $emblem)
{
$bg_info = getimagesize($background);
$e_info = getimagesize($emblem);
$prop = 6;
$e_width = $bg_info[0] / $prop;
$e_height = $bg_info[1] / $prop;
$image = imagecreatefrompng($emblem);
imagealphablending($image, false);
imageSaveAlpha($image, true);
$width = imagesx($image);
$height = imagesy($image);
if ($width > $e_width)
$x_pr = $e_width / $width;
else
$x_pr = 1;
if ($height > $e_height)
$y_pr = $e_height / $height;
else
$y_pr = 1;
if ($x_pr <= $y_pr)
$pr = $x_pr;
else
$pr = $y_pr;
$new_width = ceil($width * $pr);
$new_height = ceil($height * $pr);
$new_image = imageCreateTrueColor($new_width, $new_height);
imagealphablending($new_image, false);
imageSaveAlpha($new_image, true);
imageCopyResampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagedestroy($image);
$x_coordinate = ($bg_info[0] / 2) - ($new_width) / 2;
$y_shift = 1.07;
$y_coordinate = (($bg_info[1] / 2) - ($new_height / 2)) / $y_shift;
$bg_image = imagecreatefrompng($background);
imagealphablending($bg_image, false);
imageSaveAlpha($bg_image, true);
//imageCopyResampled($bg_image, $new_image, $x_coordinate, $y_coordinate, 0, 0, $new_width, $new_height, $new_width, $new_height);
//imagecopymerge($bg_image, $new_image, $x_coordinate, $y_coordinate, 0, 0, $new_width, $new_height, 0);
imagecopy($bg_image, $new_image, $x_coordinate, $y_coordinate, 0, 0, $new_width, $new_height);
header("Content-type: image/png");
imagepng($bg_image);
exit;
}
Сам получившийся PNG прикладываю.