Home >php教程 >PHP源码 >PNG格式图片读取时显示为黑色之解决

PNG格式图片读取时显示为黑色之解决

PHP中文网
PHP中文网Original
2016-05-25 17:13:392402browse

[PHP]代码

<?php
$fileurl = &#39;1.png&#39;;

header("Content-type: image/png");
$img = imagecreatefrompng($fileurl);
imagealphablending($img,false);  //(取消)注释此段代码验证输出
imagesavealpha($img,true);       //(取消)注释此段代码验证输出
imagepng($img);
imagedestroy($img);

/*End of php*/

                   

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:标签构建1Next article:随机颜色生成器