BUG Fixed divide by zero with SetRatioSize on missing image file

Fixes issue #2047
This commit is contained in:
Damian Mooyman 2013-07-23 11:24:48 +12:00
parent 58a2eb0155
commit b3ca4a275b

View File

@ -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;