伙计们,我用它们的X,Y坐标和给它们赋值了大约288点。我需要象征性地表明这一点。我尝试了gd和imagettftext,但是即使我安装并配置了gd,绘制空白图像的简单代码也无法正常工作。在PHP中绘制图像并且不显示任何图像
header('Content-Type: image/png');
$image = imagecreatetruecolor(400, 300);
// Allocate a color for the polygon
$col_poly = imagecolorallocate($image, 255, 255, 255);
// Draw the polygon
imagepolygon($image, array(
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// Output the picture to the browser
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
在浏览器的输出是
你试过了什么? – 2012-08-08 21:54:05
我试过这段代码,并希望用值的文本填充图像。但是一个简单的函数不工作。可能是我的GD库配置不正确。 – user1425322 2012-08-08 22:00:58
顺便说一句,为什么你设置标题两次,并以不同的情况? 还要确保你的php文件中没有空格(如果你有include,请检查它们)。 这是一个好主意,可以让图像在二进制编辑器中查看。 – 2012-08-08 22:02:12