Script stops at imagecreatefromjpeg in my script.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Silencet
    New Member
    • Aug 2007
    • 24

    Script stops at imagecreatefromjpeg in my script.

    Hi all, I, like alot of others, have been working with a script to create thumbnails, however, i've a problem were the script works, however just stops when it reaches the imagecreatefrom jpeg function, and i've been looking all over for the solution to my problem, for almost 2 days but have yet to find the solution. Maybe i'm just stupid, but i can't figure this out.

    Thank You.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Silencet.

    Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

    Is your script generating an error? Check out this article to find out what is going on.

    Comment

    • Silencet
      New Member
      • Aug 2007
      • 24

      #3
      Thanks for that refrence, ALOT, i thought you would just echo the result, but it wouldn't.

      Anyway the error is that the function is not defined, what do i need?

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Silencet.

        Looks like your installation of PHP is not configured with GD support. What's your server's operating system? Are you working on your personal computer, or is it a shared/dedicated/VPS host?

        Comment

        • Silencet
          New Member
          • Aug 2007
          • 24

          #5
          Well im using a Personal Computer, i know about GD but how do i use it with PHP

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by Silencet
            Well im using a Personal Computer, i know about GD but how do i use it with PHP

            Can we have a look at your code?

            :)

            Comment

            • Silencet
              New Member
              • Aug 2007
              • 24

              #7
              ok, i don't know why that would, help but right now i looks like so

              Code:
              <?php
              
              $img = getimagesize($file);
              
              switch($img[2])
              {
              	case 1:
              		$image = imagecreatefromgif($file);
              	break;
              	case 2:
              		$image = imagecreatefromjpeg($file);
              	break;
              	case 3:
              		$image = imagecreatefrompng($file);
              	break;
              	default:
              		echo "NO VALID FORMAT";
              	break;
              }
              echo "HERE";
              
              ?>
              im using the echo here part to check if it got past the switch part

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                Originally posted by Silencet
                ok, i don't know why that would, help but right now i looks like so

                Code:
                <?php
                
                $img = getimagesize($file);
                
                switch($img[2])
                {
                	case 1:
                		$image = imagecreatefromgif($file);
                	break;
                	case 2:
                		$image = imagecreatefromjpeg($file);
                	break;
                	case 3:
                		$image = imagecreatefrompng($file);
                	break;
                	default:
                		echo "NO VALID FORMAT";
                	break;
                }
                echo "HERE";
                
                ?>
                im using the echo here part to check if it got past the switch part
                You need to check is GD is installed.

                make a file 'phpinfo.php'

                [code=php]
                <?phpinfo?>
                [/code]

                Run it and search for the section on GD it'll tell you whether it's enabled or not :)

                Comment

                • Silencet
                  New Member
                  • Aug 2007
                  • 24

                  #9
                  that code doesn't do anything, maybe im missing somthing for that. How would i know it is enabled, is it in the ini file i've already uncommented the php_gd.dll line.

                  Comment

                  • Silencet
                    New Member
                    • Aug 2007
                    • 24

                    #10
                    ok i figured out the php info, and it is indicating that it is shared, i don't know whether or not that means it is enabled though

                    Comment

                    • pbmods
                      Recognized Expert Expert
                      • Apr 2007
                      • 5821

                      #11
                      Heya, Silencet.

                      Run the PHP installer again and choose the option to repair your installation.

                      Check the box for GD support and click next.

                      Comment

                      • Silencet
                        New Member
                        • Aug 2007
                        • 24

                        #12
                        It never prompted me with the option for gd support, so how would i set it up

                        Comment

                        • Silencet
                          New Member
                          • Aug 2007
                          • 24

                          #13
                          So do i need the source files to rebuild php with gd in it?

                          Comment

                          • pbmods
                            Recognized Expert Expert
                            • Apr 2007
                            • 5821

                            #14
                            Heya, Silencet.

                            Try changing
                            Code:
                            extension=php_gd.dll
                            to
                            Code:
                            extension=php_gd2.dll
                            in php.ini.

                            Comment

                            • Silencet
                              New Member
                              • Aug 2007
                              • 24

                              #15
                              It already is php_gd2.dll, plus, i don't think i have that file

                              Comment

                              Working...