php imagecreatetruecolorsheng生成图片无法正常显示

WBOY
Release: 2016-06-20 12:54:16
Original
787 people have browsed it

<?php    $t=imagecreatetruecolor(100,100);    $red=imagecolorallocate($t,255,0,0);    imagefill($t,0,0,$red);    header('Content-type:image/png');    imagepng($t);    imagedestroy($t);?>
Copy after login




回复讨论(解决方案)

我这边很正常,把header('Content-type:image/png'); 先去掉看看有什么错误输出。
是否有安装gd?

注释掉header('Content-type:image/png');  就乱码了

phpinfo()中的gd部分



注释掉header('Content-type:image/png');  就乱码了
这表示你的图片流中含有其他数据(你可截个图贴出来看看)
可能是有 BOM 头

解决了  是空格  用ctrl+shift+f 去了空格就可以了  

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template