mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fixed divide by zero with SetRatioSize on missing image file
Fixes issue #2047
This commit is contained in:
parent
58a2eb0155
commit
b3ca4a275b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user