diff --git a/system/ee/language/english/image_lib_lang.php b/system/ee/language/english/image_lib_lang.php index 117556a3f6..0677bf2933 100644 --- a/system/ee/language/english/image_lib_lang.php +++ b/system/ee/language/english/image_lib_lang.php @@ -36,6 +36,8 @@ 'imglib_save_failed' => 'Unable to save the image. Please make sure the image and file directory are writable.', + 'imglib_properties_failed' => 'Unable to gather properties of the image. Please make sure the image is valid and readable.', + 'imglib_source_image_required' => 'You must specify a source image in your preferences.', 'imglib_unsupported_imagecreate' => 'Your server does not support the GD function required to process this type of image.', diff --git a/system/ee/legacy/libraries/Image_lib.php b/system/ee/legacy/libraries/Image_lib.php index d4879eab3c..c108bb6902 100644 --- a/system/ee/legacy/libraries/Image_lib.php +++ b/system/ee/legacy/libraries/Image_lib.php @@ -1373,6 +1373,12 @@ public function get_image_properties($path = '', $return = false) $vals = @getimagesize($path); + if (! $vals) { + $this->set_error('imglib_properties_failed'); + + return false; + } + $types = array(IMAGETYPE_GIF => 'gif', IMAGETYPE_JPEG => 'jpeg', IMAGETYPE_PNG => 'png', '18' => 'webp'); $mime = (isset($types[$vals['2']])) ? 'image/' . $types[$vals['2']] : 'image/jpg';