【发布时间】:2013-05-26 01:42:12
【问题描述】:
这段代码出错了
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 一起使用时,它不起作用。
我尝试使用 imagecreatefrompng(file_get_contents('logo.php')); 但它也不起作用。 我想要的是把我的 png-24 版权图像放在我的 jpg 上(以保持透明度) 你们有什么解决办法吗?
【问题讨论】:
-
不是问题...它是 imagecopymerge() 不适用于 png-24。 imagecopy() 做到了!
-
自己解决这个问题做得很好:) 如果可以,请将解决方案写为答案并将其标记为已解决。
-
我将您的解决方案移至社区 wiki 答案。
标签: php png content-type imagecreatefrompng