我的代码出错了
header ("Content-type: image/jpeg");
$nomphoto = "antigua.jpg";
// On charge d'abord les images
$source = imagecreatefrompng('logo.php');
$destination = imagecreatefromjpeg($nomphoto);
$largeur_source = imagesx($source);
$hauteur_source = imagesy($source);
$largeur_destination = imagesx($destination);
$hauteur_destination = imagesy($destination);
$destination_x = 0;
$destination_y = ($hauteur_destination / 1.5) - ($hauteur_source / 2);
imagecopymerge($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source, 60);
imagejpeg($destination);我无法从logo.php加载图片
logo.php码
$imgPng = imagecreatefrompng("logo24.png");
imagealphablending($imgPng, true);
imageSaveAlpha($imgPng, true);
header("Content-type: image/png");
imagePng($imgPng); 我想把我的png-24图像版权。logo.php工作得很好,我可以得到图片,但是当我将它与图像一起使用时,它就不工作了。
我试过使用imagecreatefrompng(file_get_contents('logo.php'));,但它也不起作用。我想要的是把我的png-24版权图片放在我的jpg (保持透明度)你有什么解决方案吗?
发布于 2018-03-13 17:34:35
执行部分的解决方案。
而不是使用imagecopymerge(),,必须使用映像()
imagecopy($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source);然后就不需要logo.php代码了。只需加载png-24图像。
https://stackoverflow.com/questions/16836887
复制相似问题