Skip to content

Commit

Permalink
FIX CroppedFocusedImage failure case
Browse files Browse the repository at this point in the history
Stop issue where CroppedFocusedImage() doesn't handle the failure case like 'Image::getFormattedImage', as that function implicitly returns null if it cannot find the asset. (#35)
  • Loading branch information
silbinarywolf authored and jonom committed Oct 24, 2016
1 parent ea022f3 commit acb0e36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/FocusPointImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ public function CroppedFocusedImage($width, $height, $upscale = true)
return $this->owner;
} elseif ($cropData = $this->calculateCrop($width, $height)) {
$img = $this->owner->getFormattedImage('CroppedFocusedImage', $width, $height, $cropData['CropAxis'], $cropData['CropOffset']);
if (!$img) {
return null;
}

// Update FocusPoint
$img->FocusX = $cropData['x']['FocusPoint'];
$img->FocusY = $cropData['y']['FocusPoint'];
Expand Down

0 comments on commit acb0e36

Please sign in to comment.