Reputation: 10105
Problem
Below code is creating an image with background color black.
I was expecting it to put white color. Am I missing anything in below code?
$img = imagecreatetruecolor(600, 1000);
$bg = imagecolorallocate ( $img, 255, 255, 255 );
imagefilledrectangle($img, 0, 0, 0, 0, $bg);
imagejpeg($img, "myimg.jpg", 100);
I am following this accepted answer.
Upvotes: 0
Views: 114
Reputation: 19780
The function imagefilledrectangle()
use x1, y1 and x2, y2.
Try this :
imagefilledrectangle($img, 0, 0, 600, 1000, $bg);
or have a look to imagefill()
.
Upvotes: 1