Results 1 to 3 of 3

Thread: php image problem

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,682

    php image problem

    I have a small script that creates a small png. This is the part i'm having trouble with...

    PHP Code:
    header('Content-type: image/png');
    imagepng($img);
    imagedestroy($img); 
    I've read that i need to add another header...

    PHP Code:
    header ('Content-length: size'); 
    Judging by what i assume it should do, i've come up with this...

    PHP Code:
    $tmpfile tempnam("/tmpdir""img");
    imagepng($img$tmpfile); 
    header('Content-type: image/png');
    header ('Content-length: filesize($tmpfile)');
    imagedestroy($img); 
    But i'm guessing the header lines should come before imagepng and imagedestroy.
    How do i get the file size of my png?

  2. #2

  3. #3

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,682

    Re: php image problem

    Quote Originally Posted by wqweto View Post
    It looks like my original code will still work when my web hosting company have reinstalled the php GD library. Had a fairly major DOS last month, and my site hasn’t been running properly ever since. Web Hosting company are not as helpful as they should be.

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