3

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

すべてが終わった後、それは何か関係があると思いますimagecopy....これを修正するにはどうすればよいですか、またはこれを行う別の簡単な方法はありますか?

4

1 に答える 1

0

私は両方のコードでテストしたいと思います、そしてそれは動作します

<?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);
?>

出力http://imgur.com/kMqQbrr

于 2013-11-01T03:42:57.640 に答える