Skip to content
Snippets Groups Projects

Issue #3357133 by robphillips: DivisionByZeroError on AspectSwitcherImageEffect.

1 file
+ 4
0
Compare changes
  • Side-by-side
  • Inline
@@ -202,6 +202,10 @@ class AspectSwitcherImageEffect extends ConfigurableImageEffectBase {
* The name of the image style to process.
*/
protected function getChildImageStyleToExecute(int $width, int $height): ?string {
if (!$width || !$height) {
// Image is probably corrupted when dimensions are missing.
return NULL;
}
$ratio_adjustment = isset($this->configuration['ratio_adjustment']) ? floatval($this->configuration['ratio_adjustment']) : 1;
// Width / height * adjustment. If > 1, it's wide.
return (($width / $height * $ratio_adjustment) > 1) ? $this->configuration['landscape_image_style'] : $this->configuration['portrait_image_style'];
Loading