Home >Backend Development >PHP Tutorial >图像因其自身有错无法显示

图像因其自身有错无法显示

WBOY
WBOYOriginal
2016-06-13 11:51:35862browse

图像因其本身有错无法显示
代码如下:

<?php <br />ob_clean();<br />header("Content-type:image/png");<br />$im = @imagecreate(200, 100);<br />@imagecolorallocate($im, 240, 150, 255);<br />$color1 = imagecolorallocate($im, 0, 0, 0);<br />imagestring($im, 5, 8, 10, "I like PHP", $color1);<br />imagedestroy($im);<br />?><br />

按照网上的方法加了ob_clean();
也将文档格式变为了utf-不带bom格式的
怎么还是出错呢?
------解决方案--------------------
ob_clean();<br />header("Content-type:image/png");<br />$im = @imagecreate(200, 100);<br />@imagecolorallocate($im, 240, 150, 255);<br />$color1 = imagecolorallocate($im, 0, 0, 0);<br />imagestring($im, 5, 8, 10, "I like PHP", $color1);<br />imagepng ( $im);//少了生成图片这个语句<br />imagedestroy($im);

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