I need help badly, that is, the following php code (posted below) works perfectly fine with my former hosting company and its version of php (forgot what it is), however, since I change host and I know that they are using php version 4.4.1 and the latest version of GD, but the php script/form just doesn't work with the new host with its php version instead it only gives me error message that say that the the file is an invalid gif file when in fact, the file is there. I have posted part of the php code and the error given every time that I run it below.

Please give it a look over and help me figure out why a script working perfectly fine suddenly being rendered useless. Thank you.

<?php
if(ini_get('zlib.output_compression'))
  ini_set('zlib.output_compression', 'Off');

extract($_GET);
extract($_POST);

$id1 = imageCreateFromGIF($floorlayerimage);
$id2 = imageCreateFromGIF($walllayerimage);
$id3 = imageCreateFromGIF($backgroundlayerimage);
$idlogo = imageCreateFromGIF("logo.gif");

....

Return Error

Warning: imagecreatefromgif():

'http://mydomain.com/makers/maker_sayclub/images/walls/m_r_000000.gif' is not a valid GIF file in

/home/username/public_html/makers/maker_sayclub/saveroom.php on line 8

.
.
.
.
.
.
.

.
.
.
.

the file is indeed there in the directory http://mydomain.com/makers/maker_sayclub/images/walls/

and the script is the folder path /home/username/public_html/makers/maker_sayclub/

    Probably due to no support for .gif in the GD version

    If you have the GD library (available at http://www.boutell.com/gd/) you will also be able to create and manipulate images.

    The format of images you are able to manipulate depend on the version of GD you install, and any other libraries GD might need to access those image formats. Versions of GD older than gd-1.6 support GIF format images, and do not support PNG, where versions greater than gd-1.6 and less than gd-2.0.28 support PNG, not GIF. GIF support was re-enabled in gd-2.0.28.

    Note: Since PHP 4.3 there is a bundled version of the GD lib. This bundled version has some additional features like alpha blending, and should be used in preference to the external library since its codebase is better maintained and more stable.

    You may wish to enhance GD to handle more image formats.

    Source PHP Manual do a phpinfo() and see what is used with GD

      What if you write the image name in manually?

        Here's the whole error message (i cut some since they are mostly the same error message), and maybe I should also mention that there's no error message for the logo.gif where $idlogo = imageCreateFromGIF("logo.gif");" while for "
        $id1 = imageCreateFromGIF($floorlayerimage);
        $id2 = imageCreateFromGIF($walllayerimage);
        $id3 = imageCreateFromGIF($backgroundlayerimage);"

        all of them give error

        <?php
        if(ini_get('zlib.output_compression'))
          ini_set('zlib.output_compression', 'Off');
        
        extract($_GET);
        extract($_POST);
        
        $id1 = imageCreateFromGIF($floorlayerimage);
        $id2 = imageCreateFromGIF($walllayerimage);
        $id3 = imageCreateFromGIF($backgroundlayerimage);
        $idlogo = imageCreateFromGIF("logo.gif");
        
        .... 
        

        Warning: imagecreatefromgif(): 'http://mydomain/makers/maker_sayclub/images/floors/m_r_000145.gif' is not a valid GIF file in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 8

        Warning: imagecreatefromgif(): 'http://mydomain/makers/maker_sayclub/images/walls/m_r_000120.gif' is not a valid GIF file in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 9

        Warning: imagecreatefromgif(): 'http://mydomain/makers/maker_sayclub/images/backgrounds/m_r_000000.gif' is not a valid GIF file in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 10
        .
        .
        .

        Warning: imagesx(): supplied argument is not a valid Image resource in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 65

        Warning: imagesy(): supplied argument is not a valid Image resource in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 65

        Warning: imagecopymerge(): supplied argument is not a valid Image resource in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 65
        .
        .
        .
        Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/makers/maker_sayclub/saveroom.php:8) in /home/username/public_html/makers/maker_sayclub/saveroom.php on line 77
        .
        .
        .
        &#65533;PNG

          Provide the smallest and simplest script that demonstrates the error.

            Where are the variables $floorlayerimage etc.... assigned???

              Few things:

              1. Why are you accessing the images across http? Are they not on the same server? If they are, do NOT use http... use the file path on the system.

              2. If they are on another server, make sure you have installed a version of PHP >= 4.3.0 as prior versions do not support remote files.

              3. What is the setting of the 'allow_url_fopen' directive?

              4. What version of GD library is installed with PHP?

                Write a Reply...