日期:2014-05-17  浏览次数:20597 次

PHP绘图显示乱码
本帖最后由 jianglei2006 于 2012-11-10 23:16:10 编辑 各位主,神,以及玉皇大帝,如来佛祖!!!
求助啊,
我安装的是appserv-win32-2.5.10.exe,所以说环境配置基本是没有问题,
查看phpinfo();的时候显示数据库已经启动,GD绘图enable 
但是我创建了如下的PHP文档

exif_thumbnail.php

<?php
  $image =exif_thumbnail($_GET["picName"],$width,$height,$type);
if($image != false)
{
header("Content-type:" . image_type_to_mime_type($type));
echo $image;
exit();
}

?>

image.php

<html>
<title>shiyan
</title>
<body>

  
<IMG SRC ="exif_thumbnail.php?picName=images/a.jpg" />

</body>
</html>
运行之后就是显示小红叉叉,后来我有建立了一个新的文档


<html>
<title>实验
</title>
<body>

<?php
$im = imagecreate(200,60);
$white = imagecolorallocate($im ,225,66,159);
imagegif($im);
?>

</body>
</html>
返回的居然是一个GIF87a? ……


谁能告诉我这是怎么回事??

------最佳解决方案--------------------
exif_thumbnail.php这个文件是否正确执行了?$image == false就会是叉,而且不是什么jpeg图片都有内嵌缩略图吧。
<?php
$im = imagecreate(200,60);
$white = imagecolorallocate($im ,225,66,159);
imagegif($im);
?>
看作图片文件,在网页里用img标签引用,并且要发header
------其他解决方案--------------------
要发herder
------其他解决方案--------------------
exif_thumbnail 取得 tiff 或 jpg 中内嵌的缩略图(注意不一定就有)
需要加载 php_exif 扩展(这一点你没说明)
当$image为空的的时候,也会出现红叉。你应该用已知图片替代

最后一段代码输出 GIF87a? …… 是正确的
因为你还输出了html内容,所以图片数据会当做正文显示
------其他解决方案--------------------
要发header