Skip to content
Snippets Groups Projects

If actual dimensions are smaller than soft limits, use those

1 file
+ 9
0
Compare changes
  • Side-by-side
  • Inline
@@ -51,6 +51,15 @@ class AutomatedCrop implements EventSubscriberInterface {
$image = $event->getImage();
$hard_limit = $crop_type->getHardLimit();
$soft_limit = $crop_type->getSoftLimit();
if (!empty($soft_limit['width']) && $soft_limit['width'] > $image->getWidth()) {
$soft_limit['width'] = $image->getWidth();
}
if (!empty($soft_limit['height']) && $soft_limit['height'] > $image->getHeight()) {
$soft_limit['height'] = $image->getHeight();
}
$configuration = [
'image' => $image,
'min_width' => isset($hard_limit['width']) ? $hard_limit['width'] : $soft_limit['width'],
Loading