[RESOLVED] GD and Image function: But nothing displays on the screen
Hello Folks,
I am just trying out some piece of code relating to GD and image functions on the PHP.net website. I was expecting something to appear on the page when it is executed, but nothing displays on the page. The code below was lifted from their website, that still does not let me get desired results.
Code:
<?php
//create a blank image
$image = imagecreatetruecolor(400, 300);
//select the background color
$bg = imagecolorallocate($image, 0, 0, 0);
//fill the background with color selected above
imagefill($image, 0, 0, $bg);
//coose a color for the ellipse
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
imageellipse($image, 200, 150, 300, 200, $col_ellipse);
//output the image
header('Content-type: image/png');
imagepng($image);
?>
How do I output it then?
Thanks
Re: GD and Image function: But nothing displays on the screen
It works for me.
Make sure there are no leading or trailing characters outside the <?php ... ?> tags, and make sure your file is saved either in ANSI encoding or UTF-8 with no BOM.
Re: GD and Image function: But nothing displays on the screen
Thanks a lot. That actually solves the problem.
Menre