Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27432

php fatal error in database activity if php GD extension isnt installed

    XMLWordPrintable

Details

    • Any
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-27432_gd_error
    • Hide

      Check that your debug message level is set to "Developer". Also check the environment page and check that you do NOT have the GD extension installed.

      As a teacher create a new database activity. It will complain you have no fields defined. Elect to use a preset collection of fields. Select image gallery.
      As a student upload an image through the activity (add entry -> upload an image -> "save and view")

      A debug message saying

      Unknown exception related to local files (imagecreatefromstring() doesnt exist. The PHP extension "GD" must be installed for image conversion.)

      and providing a stack trace should be displayed. The continue link should take you to your entry.

      Note that although the fatal error has been avoided the absence of the GD php extension means that thumbnails cannot be created. If you go to "view list" youll see one or more broken images. This is expected behaviour.

      Show
      Check that your debug message level is set to "Developer". Also check the environment page and check that you do NOT have the GD extension installed. As a teacher create a new database activity. It will complain you have no fields defined. Elect to use a preset collection of fields. Select image gallery. As a student upload an image through the activity (add entry -> upload an image -> "save and view") A debug message saying Unknown exception related to local files (imagecreatefromstring() doesnt exist. The PHP extension "GD" must be installed for image conversion.) and providing a stack trace should be displayed. The continue link should take you to your entry. Note that although the fatal error has been avoided the absence of the GD php extension means that thumbnails cannot be created. If you go to "view list" youll see one or more broken images. This is expected behaviour.

    Description

      to reproduce create a new database activity. It will complain you have no fields defined. Elect to use a preset collection of fields. Select image gallery. As a student upload an image through the activity.

      I get the following php error Fatal error: Call to undefined function imagecreatefromstring() in /var/www/moodle/lib/filestorage/file_storage.php on line 994

      Oddly the teacher seems to be able to see the uploaded image but the student cant.

      Anyhow, we either need to make GD a firm requirement of Moodle (preventing install unless its present) or the database activity needs to avoid the error should GD not be present. Currently the environment does suggest the GD extension but suggesting it then throwing errors is pretty crappy.

      Attachments

        Activity

          People

            andyjdavis Andrew Davis
            andyjdavis Andrew Davis
            Sam Hemelryk Sam Hemelryk
            Aparup Banerjee Aparup Banerjee
            Rajesh Taneja Rajesh Taneja
            Amaia Anabitarte, Carlos Escobedo, Laurent David, Sabina Abellan, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Jan/12