From 0a2d5f037f86fae18183ad414fbd4216446e93fa Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 18 Jan 2015 13:32:28 +0100 Subject: [PATCH] Avoid invalid width/height (<1) + debug log added Signed-off-by: Roland Haeder --- classes/File.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/File.php b/classes/File.php index aee16e132d..9bb22e502b 100644 --- a/classes/File.php +++ b/classes/File.php @@ -391,17 +391,20 @@ class File extends Managed_DataObject throw new UnsupportedMediaException('No image geometry available.'); } - if ($width === null) { + if ($width === null || $width < 1) { $width = common_config('thumbnail', 'width'); $height = common_config('thumbnail', 'height'); $crop = common_config('thumbnail', 'crop'); } - if ($height === null) { + if ($height === null || $height < 1) { $height = $width; $crop = true; } + // Debug log (convert crop to int to have TRUE being displayed as 1 and FALSE as 0) + common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop)); + // Get proper aspect ratio width and height before lookup // We have to do it through an ImageFile object because of orientation etc. // Only other solution would've been to rotate + rewrite uploaded files. -- 2.39.5