问题
下面的代码是创建一个背景颜色为黑色的图像。
我期待它变成白色。我在下面的代码中遗漏了什么吗?
$img = imagecreatetruecolor(600, 1000);
$bg = imagecolorallocate ( $img, 255, 255, 255 );
imagefilledrectangle($img, 0, 0, 0, 0, $bg);
imagejpeg($img, "myimg.jpg", 100);
答案 0 :(得分:1)
函数imagefilledrectangle()
使用x1,y1和 x2,y2 。
试试这个:
imagefilledrectangle($img, 0, 0, 600, 1000, $bg);
或查看imagefill()
。