Merge pull request #2256 from tractorcow/3.1-setratiosize-dbz-fix

BUG Fixed divide by zero with SetRatioSize on missing image file
This commit is contained in:
Will Rossiter 2013-07-22 23:02:29 -07:00
commit ff1b0e3a08

View File

@ -206,6 +206,9 @@ class Image extends File {
*/ */
public function SetRatioSize($width, $height) { 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 // Check if image is already sized to the correct dimension
$widthRatio = $width / $this->width; $widthRatio = $width / $this->width;
$heightRatio = $height / $this->height; $heightRatio = $height / $this->height;