From 6018acfa8c1738851e56a994dbfb4f28be37a9fc Mon Sep 17 00:00:00 2001 From: Carlos Ferreira Date: Fri, 12 May 2017 09:38:26 +0200 Subject: [PATCH] Create GDimage from data if JPEG fails - Fix #2561 See https://secure.php.net/manual/en/function.imagecreatefromjpeg.php#refsect1-function.imagecreatefromjpeg-examples --- protected/humhub/modules/file/libs/ImageConverter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protected/humhub/modules/file/libs/ImageConverter.php b/protected/humhub/modules/file/libs/ImageConverter.php index 7cfd430cfe..c543b77d0a 100644 --- a/protected/humhub/modules/file/libs/ImageConverter.php +++ b/protected/humhub/modules/file/libs/ImageConverter.php @@ -355,7 +355,10 @@ class ImageConverter $gdImage = imagecreatefromgif($fileName); break; case IMAGETYPE_JPEG: - $gdImage = imagecreatefromjpeg($fileName); + $gdImage = @imagecreatefromjpeg($fileName); + if (!$gdImage) { + $gdImage = imagecreatefromstring(file_get_contents($fileName)); + } break; } } catch (\Exception $ex) {