From b3ca4a275bc10e82e85167a842d94d694c94ae0b Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 23 Jul 2013 11:24:48 +1200 Subject: [PATCH] BUG Fixed divide by zero with SetRatioSize on missing image file Fixes issue #2047 --- model/Image.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/model/Image.php b/model/Image.php index 22fc1f644..006135bdb 100644 --- a/model/Image.php +++ b/model/Image.php @@ -206,6 +206,9 @@ class Image extends File { */ public function SetRatioSize($width, $height) { + // Prevent divide by zero on missing/blank file + if(empty($this->width) || empty($this->height)) return null; + // Check if image is already sized to the correct dimension $widthRatio = $width / $this->width; $heightRatio = $height / $this->height;