Results 1 to 3 of 3

Thread: [RESOLVED] GD and Image function: But nothing displays on the screen

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    150

    Resolved [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

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    150

    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
  •  



Click Here to Expand Forum to Full Width