关于这段代码提示的错误

zp7999 zp7999 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<?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
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
zp7999
基础编程 21,889 成员 140,329 内容