php5 upgrade - imagecreatefromgif no longer working?

Discussion in 'PHP' started by redherring, Jan 25, 2008.

  1. #1
    Hi there -

    I was forced into an "upgrade" from php 4.3.8 to 5.2.5 today.

    We have a bunch of pages that employ the imagecreatefromgif function, and none of these are working since the move to php5.

    These page, highly dumbed down, are all as follows:

    *************************

    <?php
    header ("Content-type: image/png");

    $im = imagecreatefromgif("http://www.mydomain.com/images/myimage.gif");

    imagepng ($im);
    ?>

    *************************

    Assuming that the page is called "testimage.php", when browsed to the page simply renders a broken image of property "testimage.php"

    I can confirm that the image "http://www.mydomain.com/images/myimage.gif" exists.

    There must be something fundamental missing from my php5 installation. Here's hoping that somebody can point me in the right direction.

    Thanks!
     
    redherring, Jan 25, 2008 IP
  2. redherring

    redherring Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    And the following test, taken from elsewhere, also just renders a broken image:

    ************************************

    <?php
    function LoadGif ($imgname)
    {
    $im = @imagecreatefromgif ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
    $im = imagecreatetruecolor (150, 30); /* Create a blank image */
    $bgc = imagecolorallocate ($im, 255, 255, 255);
    $tc = imagecolorallocate ($im, 0, 0, 0);
    imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
    /* Output an errmsg */
    imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
    }
    return $im;
    }
    header("Content-Type: image/gif");
    $img = LoadGif("bogus.image");
    imagegif($img);
    ?>
     
    redherring, Jan 25, 2008 IP
  3. sharqi

    sharqi Guest

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    make sure the gd libary is enabled on the new install
     
    sharqi, Jan 25, 2008 IP