imagecreatefromgif not working

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

    imagecreatefromgif not working

    Hi, I've tried to upload a picture using the function
    imagecreatefrom gif, with a script as simple as possible to avoid miss
    spellings and stuff like that. I've ran the following line of code to
    see if my host had the right gd lib, and it was positive:

    <?PHP print_r(gd_info ()); ?>

    so if it's not the server, what am i missing?
    Here is my tiny script as it looks now:

    <?php
    function billede()
    {
    $bill = imageCreateFrom GIF ("hindenburg.gi f");
    return $bill;
    }
    billede();
    ?>

    Thanks for your help :)

  • Bob Bedford

    #2
    Re: imagecreatefrom gif not working

    What's the error message ?
    "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
    1155222164.2721 96.308140@i3g20 00...legro ups.com...
    Hi, I've tried to upload a picture using the function
    imagecreatefrom gif, with a script as simple as possible to avoid miss
    spellings and stuff like that. I've ran the following line of code to
    see if my host had the right gd lib, and it was positive:
    >
    <?PHP print_r(gd_info ()); ?>
    >
    so if it's not the server, what am i missing?
    Here is my tiny script as it looks now:
    >
    <?php
    function billede()
    {
    $bill = imageCreateFrom GIF ("hindenburg.gi f");
    return $bill;
    }
    billede();
    ?>
    >
    Thanks for your help :)
    >
    >


    Comment

    • moxmormor

      #3
      Re: imagecreatefrom gif not working


      Bob Bedford wrote:
      What's the error message ?
      "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
      1155222164.2721 96.308140@i3g20 00...legro ups.com...

      There was no error message. The screen was just blank.



      Comment

      • Bob Bedford

        #4
        Re: imagecreatefrom gif not working

        "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
        1155223179.3607 93.164800@m73g2 00...legr oups.com...

        Bob Bedford wrote:
        What's the error message ?
        "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
        1155222164.2721 96.308140@i3g20 00...legro ups.com...

        There was no error message. The screen was just blank.



        Are you sure about the file path ? try to add the complete path of the file,
        maybe with a if file_exists() to be sure...and print an error message if it
        doesn't exists.



        Comment

        • moxmormor

          #5
          Re: imagecreatefrom gif not working

          Are you sure about the file path ? try to add the complete path of the file,
          maybe with a if file_exists() to be sure...and print an error message if it
          doesn't exists.

          Now I'm confused. When it executed the following script, the output was
          'nonexistant'.

          <?php
          function billede()
          {
          if (!file_exists(' hindenburg.gif' ))
          {
          $bill = imageCreateFrom GIF ('hindenburg.gi f');
          return $bill;
          }
          else
          echo "nonexistan t";
          }
          billede();
          ?>

          However, when I changed 'hindenburg.gif ' to
          'moxmormor_org/htdocs/hindenburg.gif' it went blank again.

          Comment

          • moxmormor

            #6
            Re: imagecreatefrom gif not working

            Are you sure about the file path ? try to add the complete path of the file,
            maybe with a if file_exists() to be sure...and print an error message if it
            doesn't exists.

            Now I'm confused. When it executed the following script, the output was
            'nonexistant'.

            <?php
            function billede()
            {
            if (!file_exists(' hindenburg.gif' ))
            {
            $bill = imageCreateFrom GIF ('hindenburg.gi f');
            return $bill;
            }
            else
            echo "nonexistan t";
            }
            billede();
            ?>

            However, when I changed 'hindenburg.gif ' to
            'moxmormor_org/htdocs/hindenburg.gif' it went blank again.

            Comment

            • Bob Bedford

              #7
              Re: imagecreatefrom gif not working


              "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
              1155225702.2444 79.229140@i42g2 00...legr oups.com...
              >Are you sure about the file path ? try to add the complete path of the
              >file,
              >maybe with a if file_exists() to be sure...and print an error message if
              >it
              >doesn't exists.
              >
              >
              Now I'm confused. When it executed the following script, the output was
              'nonexistant'.
              >
              <?php
              function billede()
              {
              if (!file_exists(' hindenburg.gif' ))
              {
              $bill = imageCreateFrom GIF ('hindenburg.gi f');
              return $bill;
              }
              else
              echo "nonexistan t";
              }
              billede();
              ?>
              >
              However, when I changed 'hindenburg.gif ' to
              'moxmormor_org/htdocs/hindenburg.gif' it went blank again.
              You shouldn't user a path like this, instead use server variables in order
              to be sure:
              change moxmormor_org/htdocs/hindenburg.gif
              to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;

              also be very carefull, on Linux the filesystem is case sensitive, so
              hindenburg.gif <hindenburg.G IF
              Bob



              Comment

              • moxmormor

                #8
                Re: imagecreatefrom gif not working

                You shouldn't user a path like this, instead use server variables in order
                to be sure:
                change moxmormor_org/htdocs/hindenburg.gif
                to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                >
                also be very carefull, on Linux the filesystem is case sensitive, so
                hindenburg.gif <hindenburg.G IF
                Bob
                Thank you, but it's still nonexistant. :(

                Comment

                • Bob Bedford

                  #9
                  Re: imagecreatefrom gif not working

                  "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
                  1155228023.7477 26.202260@b28g2 00...legr oups.com...
                  >You shouldn't user a path like this, instead use server variables in
                  >order
                  >to be sure:
                  >change moxmormor_org/htdocs/hindenburg.gif
                  >to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                  >>
                  >also be very carefull, on Linux the filesystem is case sensitive, so
                  >hindenburg.g if <hindenburg.G IF
                  >Bob
                  >
                  Thank you, but it's still nonexistant. :(
                  try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
                  your config root is wrong (pointing to the wrong file). Also to be sure, put
                  everything in a var:

                  $filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                  echo $filename;
                  if(file_exists( $filename))
                  echo 'file exists';
                  else
                  echo 'file doesnt exist';

                  Bob

                  Are you on linux or XP ?



                  Comment

                  • moxmormor

                    #10
                    Re: imagecreatefrom gif not working

                    try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
                    your config root is wrong (pointing to the wrong file). Also to be sure, put
                    everything in a var:
                    >
                    $filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                    echo $filename;
                    if(file_exists( $filename))
                    echo 'file exists';
                    else
                    echo 'file doesnt exist';
                    >
                    Bob
                    Pretty strange. Now the output is that the file is nonexistant, then
                    the full path, then that the file DOES exist.

                    >
                    Are you on linux or XP ?
                    I'm on a Linux server I'm pretty sure. Since they are operating with
                    php. My PC is XP.

                    Comment

                    • Bob Bedford

                      #11
                      Re: imagecreatefrom gif not working

                      "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
                      1155230244.6061 57.221710@m79g2 00...legr oups.com...
                      >try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
                      >your config root is wrong (pointing to the wrong file). Also to be sure,
                      >put
                      >everything in a var:
                      >>
                      >$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                      >echo $filename;
                      >if(file_exists ($filename))
                      > echo 'file exists';
                      >else
                      > echo 'file doesnt exist';
                      >>
                      >Bob
                      >
                      Pretty strange. Now the output is that the file is nonexistant, then
                      the full path, then that the file DOES exist.
                      Sorry I don't understand what you mean. What do you mean for output file ?
                      the full path is OK, are you sure on case (Linux is case sensitive,
                      remember), where the file DOES exists ?
                      >Are you on linux or XP ?
                      >
                      I'm on a Linux server I'm pretty sure. Since they are operating with
                      php. My PC is XP.
                      PHP can run on XP too, but if it's a professional web hosting, probably it's
                      on Linux.
                      On your page I've this result:
                      nonexistant/var/www/virtual/moxmormor.byeth ost11.com/moxmormor_org/htdocs/hindenburg.gife xistant
                      why there is a nonexistant and then an existant ? Your code is called twice
                      ?
                      Could you send the entire code ? I'll check it for you.
                      I found the moxmormor.byeth ost11.com in your address quite strange altrough.
                      Bob



                      Comment

                      • moxmormor

                        #12
                        Re: imagecreatefrom gif not working


                        Bob Bedford wrote:
                        "moxmormor" <moxmormor@gmai l.coma écrit dans le message de news:
                        1155230244.6061 57.221710@m79g2 00...legr oups.com...
                        try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
                        your config root is wrong (pointing to the wrong file). Also to be sure,
                        put
                        everything in a var:
                        >
                        $filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                        echo $filename;
                        if(file_exists( $filename))
                        echo 'file exists';
                        else
                        echo 'file doesnt exist';
                        >
                        Bob
                        Pretty strange. Now the output is that the file is nonexistant, then
                        the full path, then that the file DOES exist.
                        Sorry I don't understand what you mean. What do you mean for output file ?
                        The output of my commands. The output, as you can see in the code,
                        tells me that the two paths are alike, but the one exists and the other
                        doesn't.
                        the full path is OK, are you sure on case (Linux is case sensitive,
                        remember), where the file DOES exists ?
                        yes, I've got everything in the same folder. And I have gained access
                        to textfiles in that folder before.
                        Are you on linux or XP ?
                        I'm on a Linux server I'm pretty sure. Since they are operating with
                        php. My PC is XP.
                        PHP can run on XP too, but if it's a professional web hosting, probably it's
                        on Linux.
                        On your page I've this result:
                        nonexistant/var/www/virtual/moxmormor.byeth ost11.com/moxmormor_org/htdocs/hindenburg.gife xistant
                        why there is a nonexistant and then an existant ? Your code is called twice
                        ?
                        Could you send the entire code ? I'll check it for you.
                        Here it is:

                        <?php
                        function billede()
                        {
                        if
                        (!file_exists('/var/www/virtual/moxmormor.byeth ost11.com/moxmormor_org/htdocs/hindenburg.gif' ))
                        {
                        $bill = imageCreateFrom GIF
                        ('/var/www/virtual/moxmormor.byeth ost11.com/moxmormor_org/htdocs/hindenburg..gif ');
                        return $bill;
                        }
                        else
                        echo "nonexistan t";
                        }
                        billede();
                        $filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ;
                        echo $filename;
                        if(file_exists( $filename))
                        echo 'existant';
                        else
                        echo 'nonexistant';
                        ?>

                        Thank you for your effort :)
                        I found the moxmormor.byeth ost11.com in your address quite strange altrough.
                        I started with a free account at byethost to check it out. then I
                        changed to a paid solution, and got my public DNS changed or something.
                        There is a reasonable explanation, although I don't understand it ;)
                        Bob

                        Comment

                        • Chung Leong

                          #13
                          Re: imagecreatefrom gif not working

                          moxmormor wrote:
                          Hi, I've tried to upload a picture using the function
                          imagecreatefrom gif, with a script as simple as possible to avoid miss
                          spellings and stuff like that. I've ran the following line of code to
                          see if my host had the right gd lib, and it was positive:
                          >
                          <?PHP print_r(gd_info ()); ?>
                          >
                          so if it's not the server, what am i missing?
                          Here is my tiny script as it looks now:
                          >
                          <?php
                          function billede()
                          {
                          $bill = imageCreateFrom GIF ("hindenburg.gi f");
                          return $bill;
                          }
                          billede();
                          ?>
                          What are you expecting the script to do? It doesn't actually do
                          anything. It just open the gif file and doesn't produce any output.

                          Comment

                          • moxmormor

                            #14
                            Re: imagecreatefrom gif not working

                            What are you expecting the script to do? It doesn't actually do
                            anything. It just open the gif file and doesn't produce any output.
                            OK then that's why. I just expected the return statement did the job.
                            How should i then show the image once I've opened it?

                            Comment

                            • Bob Bedford

                              #15
                              Re: imagecreatefrom gif not working

                              Try this:

                              <?php
                              function billede($filena me){
                              if(!file_exists ($filename)){
                              $bill = imageCreateFrom GIF($filename);
                              return $bill;
                              }else
                              echo "file already existent, cannot create new file<br>";
                              }
                              $filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' ; //this avoid a lot
                              of problem. Typing manually the file will get you into trouble later...
                              echo $filename.'<br> ';
                              $img = billede($filena me);
                              /*if(file_exists ($filename))
                              echo 'existant'; //should always be called has it would be created if it
                              wasn't existent before or already exists.
                              else
                              echo 'nonexistant';*/
                              ?>
                              >Thank you for your effort :)
                              np.

                              try this code and let me know.

                              Bob



                              Comment

                              Working...