mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
commit
ff1b0e3a08
@ -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…
x
Reference in New Issue
Block a user