mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02: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) {
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user