GD Error on displaying png image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Xiao Tencas

    GD Error on displaying png image

    When trying to load a png image in GD, I get the error (Mozilla Firefox)
    "cannot display image, because it contains errors"; IE just shows an empty
    'image-error' box.
    When loading a large enough image, it does build up the image
    gradually until it's almost finished, but then the partly visible image
    is replaced by the error message/error box as described above.
    It seems like indexed <256cols pngs are not subject to this problem. I've
    read that earlier versions of GD were limited to handling indexed pngs
    only, but recent GD versions (>=2.0) should not.

    My configuration:
    GNU/Debian Linux 3.0, Apache 1.3.31, PHP 4.3.4, GD 2.0 'or higher'
    (bundled with PHP), libpng12-0 1.2.5.0-7,
    Also tested on GNU/Slackware Linux 9.0 with Apache 2.0.49, PHP 4.3.6,
    GD 2.0.22, with similar results.



    The testcode I use:
    <?php
    $photo = "image.png" ;
    $im = @ImageCreateFro mPng ($photo);
    header ("Content-type: image/png");
    ImagePng ($im);
    ?>

    Anyone got a clue? Thanks in advance.
    Wim




  • Andy Hassall

    #2
    Re: GD Error on displaying png image

    On Sun, 29 Aug 2004 16:52:40 +0200, "Xiao Tencas" <xiao_tencas@gm x.net> wrote:
    [color=blue]
    >When trying to load a png image in GD, I get the error (Mozilla Firefox)
    >"cannot display image, because it contains errors"; IE just shows an empty
    >'image-error' box.
    >When loading a large enough image, it does build up the image
    >gradually until it's almost finished, but then the partly visible image
    >is replaced by the error message/error box as described above.[/color]

    A wild guess; how long does the image take to download? Is it exceeding the
    setting of max_execution_t ime? This would dump an error message in the image
    data and so could cause this symptom.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • Jeffrey Silverman

      #3
      Re: GD Error on displaying png image

      On Sun, 29 Aug 2004 16:52:40 +0200, Xiao Tencas wrote:
      [color=blue]
      > The testcode I use:
      > <?php
      > $photo = "image.png" ;
      > $im = @ImageCreateFro mPng ($photo);
      > header ("Content-type: image/png");
      > ImagePng ($im);
      > ?>[/color]

      No clue. But to debug GD images, you can change the header to
      "Content-type: text/plain" temporarily. This will dump the contents to the
      screen as plain text, including error messages!

      --
      Jeffrey D. Silverman | jeffreyPANTS@jh u.edu **
      Website | http://www.newtnotes.com

      (** Drop "pants" to reply by email)

      Comment

      Working...