PHP dies when you use imagecreatefromjpeg()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • comp.lang.php

    PHP dies when you use imagecreatefromjpeg()

    PHP version 4.3.9
    GD version 2.0.2

    Whenever I use imagecreatefrom jpeg(), PHP completely dies. No errors,
    no warnings, no notices, it dies in the following manner:

    If using Firefox it just stops running cold
    If using Konqueror you get the message "An error occurred while
    processing http://www.blah.com/tools/app"

    I can't get any more information than that. Has anyone run into this
    before?

    Thanx
    Phil

  • Mike Youell

    #2
    Re: PHP dies when you use imagecreatefrom jpeg()


    Not had this problem before and I've used it on Macs and PC's on most
    browsers.

    Does it do the same with imagecreatefrom gif() ?

    Maybe send you code for someone on here to check...

    Thanks,
    Mike Youell.

    Comment

    • Erwin Moller

      #3
      Re: PHP dies when you use imagecreatefrom jpeg()

      comp.lang.php wrote:
      [color=blue]
      > PHP version 4.3.9
      > GD version 2.0.2
      >
      > Whenever I use imagecreatefrom jpeg(), PHP completely dies. No errors,
      > no warnings, no notices, it dies in the following manner:
      >
      > If using Firefox it just stops running cold
      > If using Konqueror you get the message "An error occurred while
      > processing http://www.blah.com/tools/app"
      >
      > I can't get any more information than that. Has anyone run into this
      > before?
      >
      > Thanx
      > Phil[/color]

      Hi Phil,

      If you want to debug imagecreation scripts, you need some way to get to the
      errors.
      If you have a PHP script that returns an image (content-type: image/png etc
      etc) I found the easiest way to change the header of that script into
      text/html, in that way if you call the script directly, you'll see the
      errors.
      Of course, you can also let PHP log errors (from php.ini) and find them in
      the logfile.
      In both cases, make sure you have errorreporting on, to E_ALL & E_STRICT

      Hope that helps.

      Regards,
      Erwin Moller

      Comment

      • comp.lang.php

        #4
        Re: PHP dies when you use imagecreatefrom jpeg()


        Erwin Moller wrote:[color=blue]
        > comp.lang.php wrote:
        >[color=green]
        > > PHP version 4.3.9
        > > GD version 2.0.2
        > >
        > > Whenever I use imagecreatefrom jpeg(), PHP completely dies. No errors,
        > > no warnings, no notices, it dies in the following manner:
        > >
        > > If using Firefox it just stops running cold
        > > If using Konqueror you get the message "An error occurred while
        > > processing http://www.blah.com/tools/app"
        > >
        > > I can't get any more information than that. Has anyone run into this
        > > before?
        > >
        > > Thanx
        > > Phil[/color]
        >
        > Hi Phil,
        >
        > If you want to debug imagecreation scripts, you need some way to get to the
        > errors.
        > If you have a PHP script that returns an image (content-type: image/png etc
        > etc) I found the easiest way to change the header of that script into
        > text/html, in that way if you call the script directly, you'll see the
        > errors.
        > Of course, you can also let PHP log errors (from php.ini) and find them in
        > the logfile.
        > In both cases, make sure you have errorreporting on, to E_ALL & E_STRICT
        >[/color]

        Sorry I did all of that, including putting the line
        error_reporting (E_ALL & E_STRICT) right before the
        imagecreatefrom jpeg() functional command, to no avail.

        Furthermore, nothing noted in the error logs in php nor httpd. Here is
        the code:

        // ATTEMPT TO CREATE IMAGE OBJECT BASED UPON PHP GD FUNCTION CALL
        BASED ON IMAGE MIME TYPE
        if ($this->isSuccessful ) {
        $func = $functionArray[$type];
        if ((int)$willDown load === 1) {
        //eval('$image = $func("$tmpImag eDownloadDir/" .
        $this->fileName);') ; // CREATE IMAGE OBJECT FROM TEMP DIRECTORY
        $image = imagecreatefrom jpeg("$tmpImage DownloadDir/"
        .. $this->fileName);
        } else {
        //eval('$image = $func("$locatio nPath/" . $this->fileName);') ; //
        CREATE IMAGE OBJECT OF APPROPRIATE MIME TYPE
        $image = imagecreatefrom jpeg("$location Path/" .
        $this->fileName);
        }

        I checked and the image exists, the file directories exist, and
        phpinfo() reveals that GD is enabled.

        Phil
        [color=blue]
        > Hope that helps.
        >
        > Regards,
        > Erwin Moller[/color]

        Comment

        • Oli Filth

          #5
          Re: PHP dies when you use imagecreatefrom jpeg()

          comp.lang.php said the following on 10/04/2006 16:51:[color=blue]
          > Erwin Moller wrote:[/color]
          [color=blue][color=green]
          >> In both cases, make sure you have errorreporting on, to E_ALL & E_STRICT
          >>[/color]
          >
          > Sorry I did all of that, including putting the line
          > error_reporting (E_ALL & E_STRICT) right before the
          > imagecreatefrom jpeg() functional command, to no avail.[/color]

          Ah well you don't want to do that. (E_ALL & E_STRICT) == 0, which
          results in no errors reported at all.

          You want (E_ALL | E_STRICT).


          --
          Oli

          Comment

          • comp.lang.php

            #6
            Re: PHP dies when you use imagecreatefrom jpeg()


            Oli Filth wrote:[color=blue]
            > comp.lang.php said the following on 10/04/2006 16:51:[color=green]
            > > Erwin Moller wrote:[/color]
            >[color=green][color=darkred]
            > >> In both cases, make sure you have errorreporting on, to E_ALL & E_STRICT
            > >>[/color]
            > >
            > > Sorry I did all of that, including putting the line
            > > error_reporting (E_ALL & E_STRICT) right before the
            > > imagecreatefrom jpeg() functional command, to no avail.[/color]
            >
            > Ah well you don't want to do that. (E_ALL & E_STRICT) == 0, which
            > results in no errors reported at all.
            >
            > You want (E_ALL | E_STRICT).
            >
            >[/color]

            Thanx, however, that reported nothing either. I might have fixed it,
            because in /var/log/httpd Apache logged the error that PHP apparently
            could not.

            It seems to be a memory limit error; the image was too big to load into
            imagecreatefrom jpeg()

            Phil
            [color=blue]
            > --
            > Oli[/color]

            Comment

            • Erwin Moller

              #7
              Re: PHP dies when you use imagecreatefrom jpeg()

              Oli Filth wrote:
              [color=blue]
              > comp.lang.php said the following on 10/04/2006 16:51:[color=green]
              >> Erwin Moller wrote:[/color]
              >[color=green][color=darkred]
              >>> In both cases, make sure you have errorreporting on, to E_ALL & E_STRICT
              >>>[/color]
              >>
              >> Sorry I did all of that, including putting the line
              >> error_reporting (E_ALL & E_STRICT) right before the
              >> imagecreatefrom jpeg() functional command, to no avail.[/color]
              >
              > Ah well you don't want to do that. (E_ALL & E_STRICT) == 0, which
              > results in no errors reported at all.
              >
              > You want (E_ALL | E_STRICT).[/color]

              Oops, that is what I ment.
              SOrry for the confusion. :-)

              Regards,
              Erwin Moller

              Comment

              Working...