I am a newcomer to php graphics, so I copied/pasted code which is supposed to work, but it doesn't! I just keep getting an error message which says "the image(http://localhost/alien/newpage.php
) cannot be displayed, because it contains errors".
First off, that 'image' appears to be a file name, not an image!
Second, even when I have got the image, the rest of the page turns a dark grey instead of a nice, pristine white!
I know the header() has to be the first thing on the page, but the page also needs to get session variables - is this interfering in any way?
Basically, the large black square is intended to be a background on which filled circles (representing stars) will be plotted. Is this the best way to achieve this effect?
Sorry - that's 2 questions. I only really expect an answer to the first one!
Here's the page:
header ("Content-type: image/jpg");
$im = imagecreate (800, 800);
$black = ImageColorAllocate ($im, 0, 0, 0); // background color
ImageFilledRectangle($im, 140, 240, 640, 740, $black);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta name="" content="">