Skip to content
Snippets Groups Projects

Issue #3357133: DivisionByZeroError on AspectSwitcherImageEffect

1 file
+ 4
0
Compare changes
  • Side-by-side
  • Inline
@@ -191,6 +191,10 @@ class AspectSwitcherImageEffect extends ConfigurableImageEffectBase {
* The name of the image style to process.
*/
protected function getChildImageStyleToExecute($width, $height) {
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