-
Sep 14th, 2012, 07:41 PM
#1
Thread Starter
Addicted Member
[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
-
Sep 17th, 2012, 04:22 AM
#2
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.
-
Sep 20th, 2012, 03:17 PM
#3
Thread Starter
Addicted Member
Re: GD and Image function: But nothing displays on the screen
Thanks a lot. That actually solves the problem.
Menre
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|