我有一个问题,
imagecopy
变量上的某些图像不会出现,即使在工作和不工作示例上都有$url
。 PNG
变量从服务器加载透明图像,$local
变量从远程服务器加载。我已经包含了 $url
的测试透明图像。工作:
$local
<?php
header("Content-type: image/png");
$url = imagecreatefrompng("url_removed.png");
$local = imagecreatefrompng("http://url_removed.png");
imagecopy($url, $local, 0, 0, 0, 0, 100, 100);
imagepng($url);
imagedestroy($url);
imagedestroy($local);
?>
我什至尝试过将
<?php
header("Content-type: image/png");
$url = imagecreatefrompng("url_removed.png");
$local = imagecreatefrompng("http://url_removed.png");
imagecopy($url, $local, 0, 0, 0, 0, 100, 100);
imagepng($url);
imagedestroy($url);
imagedestroy($local);
?>
与
imagecreatestring
一起使用,这也有效,但某些file_get_contents
图像它不像与PNG
那样工作说了这么多,我认为这与
imagecreatefrompng
有关......我能做些什么来解决这个问题,或者还有其他简单的方法吗?
<?php
header("Content-type: image/png");
$url = imagecreatefrompng("http://i.imgur.com/F7Jpk9y.png");
$local = imagecreatefrompng("http://i.imgur.com/0A81XrP.png");
// use imagecopymerge instead and set the copied image opacity to 50
imagecopymerge($url, $local, 0, 0, 0, 0, 64, 64,50);
imagepng($url);
imagedestroy($url);
imagedestroy($local);
?>
:
error/warnings logs
您可以在其中找到导致图像加载过程中出现错误的原因。