关于这段代码提示的错误

zp7999 2006-06-16 03:29:58
<?php
//在线拍照设置
//相框所在文件夹名

$width = (int)$_POST["width"];
$height = (int)$_POST["height"];
$colors =(int)$_POST["image"];

function hex2rgb($color)
{
return array(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
}

$im = imagecreatetruecolor($width, $height);
imagecolorallocate($im, 255, 255, 255);

$pixs = explode(",", $colors);
array_pop($pixs);

$x = 0;
$y = 0;

$im1 = imagecreate(1, 1);

foreach ($pixs as $p)
{
list($r, $g, $b) = hex2rgb($p);

$_color = imagecolorallocate($im, $r, $g, $b);
imagesetpixel($im, $x, $y, $_color);

$x ++;
if ($x == $width)
{
$x = 0;
$y += 1;
}
}
$filename=time().".jpg";

if(!imagejpeg($im,"image/".$filename)){
echo "图片生成错误";
}
Header("location: pttsave.asp?filename={$filename}");


?>

提示错误: Fatal error: Call to undefined function imagecreatetruecolor() in G:\xiuwo\ds\dsf\dsf\dsfptt\upload.php on line 14
...全文
102 5 打赏 收藏 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zp7999 2006-06-16
  • 打赏
  • 举报
回复
已经解决 谢谢 为什么生成的图片是黑颜色的啊?什么也看不清楚
zp7999 2006-06-16
  • 打赏
  • 举报
回复
我装的是PHP5.0的 代码没有错误吗?
xuzuning 2006-06-16
  • 打赏
  • 举报
回复
检查是否安装了gd库
确认gd库为2.0以上
zp7999 2006-06-16
  • 打赏
  • 举报
回复
装过了 我装的是PHP5.0
Gdj 2006-06-16
  • 打赏
  • 举报
回复
检查你是不是装了gd库。

用这个查phpinfo();

21,889

社区成员

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

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