MDL-60819 core_files: fix exception thrown from generate_image_thumbnail
authorJake Dallimore <jake@moodle.com>
Wed, 30 May 2018 01:55:23 +0000 (09:55 +0800)
committerJake Dallimore <jake@moodle.com>
Mon, 11 Jun 2018 02:44:51 +0000 (10:44 +0800)
This function now requires gdlib.php.

lib/filestorage/stored_file.php

index 0f67664..f1c3f75 100644 (file)
@@ -1063,6 +1063,9 @@ class stored_file {
      * @return  string|bool false if a problem occurs, the thumbnail image data otherwise
      */
     public function generate_image_thumbnail($width, $height) {
+        global $CFG;
+        require_once($CFG->libdir . '/gdlib.php');
+
         if (empty($width) or empty($height)) {
             return false;
         }