php GD函数库问题 急!!

sbb928 2003-10-14 03:25:05
我用的是PHP4,当我用以下代码画线时:
$im=imagecreate(200,200) or die("Cannot Initialize new GD stream");
$col_black =ImageColorAllocate($im, 0,0,0);
imageline($im, 10, 20, 45, 85, $col_black);
ImagePNG($im);
ImageDestroy($im);


用浏览器浏览结果出现乱码:
塒NG IHDR?棖<PLTE=IDATx滍羴脿鵖_U|P跔IEND瓸`?/body>


请问这是原因?
...全文
86 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
feel8 2003-10-14
  • 打赏
  • 举报
回复
header ("Content-type: image/png")
这句放在最开头,<?php 后面的第一行。否则会有乱码
sbb928 2003-10-14
  • 打赏
  • 举报
回复
header ("Content-type: image/png") 我也加的,还是不行。

/*
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
*/
怎么用啊?
shuiaaa 2003-10-14
  • 打赏
  • 举报
回复
gd
___________________________
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

___________________________

php.ini打开了吗???
xuzuning 2003-10-14
  • 打赏
  • 举报
回复
缺少头
Header("Content-type: image/png");

一个黑方块
nhconch 2003-10-14
  • 打赏
  • 举报
回复
输出的时候要header ("Content-type: image/png");

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧