From 46fe1f6db8395381c71e2e7fba3d1c2d979cbfbc Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 3 Feb 2015 17:27:40 +0100 Subject: lib/Image->get: check if ob_get_clean worked Signed-off-by: Florian Pritz --- application/controllers/file.php | 5 ----- application/libraries/Image.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index 538155c55..fa34ecba9 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -564,11 +564,6 @@ class File extends MY_Controller { $img = new libraries\Image($this->mfile->file($filedata["hash"])); $img->makeThumb($thumb_size, $thumb_size); $thumb = $img->get(IMAGETYPE_JPEG); - - if ($thumb === false) { - throw new \exceptions\PublicApiException("file/thumbnail/generation-failed", "Failed to generate thumbnail"); - } - return $thumb; }); diff --git a/application/libraries/Image.php b/application/libraries/Image.php index ae7be844e..0f920358a 100644 --- a/application/libraries/Image.php +++ b/application/libraries/Image.php @@ -93,7 +93,7 @@ class Image { } $result = ob_get_clean(); - if (!$ret) { + if (!$ret || $result === false) { throw new \exceptions\ApiException("libraries/Image/thumbnail-creation-failed", "Failed to create thumbnail"); } -- cgit v1.2.3-24-g4f1b