I am working with PHP-GD.When i try to create image using "imagecreatetruecolor" function in PHP the image is generated.But the main problem here is the image thus generated has a black background as specified in the code but the rest of the whole page also turns grey and the image is displayed at the center of the window regardless of the attributes given in the imagecreatetruecolor function.I have been working since four months on PHP-GD it never happened to me. But form the last week its behaving awkward.Please help me to solve.
<?php
header("Content-type: image/png");
$img = imagecreatetruecolor(400, 400);
$white = imagecolorallocate($img, 255, 255, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
imagefilledellipse($img,100,100,10,10,$green);
imagefilledellipse($img,200,200,10,10,$green);
imagepng($img);
imagedestroy($img);
?>
This is the result of Chrome and not GD. The latest version of Chrome centers the image in your window and gives the rest of the window a black background.
If you want to see this in actions, add the following code to give your image a white background:
imagefill($img, 0, 0, $white);
Which will give you the following: