Skip to content

Commit

Permalink
Avoid triggering exceptions in ImageManipulation
Browse files Browse the repository at this point in the history
Check that the image exists and has size (#63)
  • Loading branch information
mikenz authored and jonom committed Jul 1, 2019
1 parent 7c51b37 commit 09ae334
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FieldType/DBFocusPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,16 @@ public function FocusFill($width, $height, AssetContainer $image, $upscale = tru
if (!$image && $this->record instanceof Image) {
$image = $this->record;
}
if (!$image->exists()) {
return $image;
}
$width = intval($width);
$height = intval($height);
$imgW = $image->getWidth();
$imgH = $image->getHeight();
if (!$imgW || !$imgH) {
return $image;
}

// Don't enlarge
if (!$upscale) {
Expand Down

0 comments on commit 09ae334

Please sign in to comment.