DivisionByZeroError: Division by zero in Drupal\automated_crop\AbstractAutomatedCrop->setAspectRatio()

Created on 13 January 2025, 9 days ago

Problem/Motivation

The following error is triggered when trying to calculate the automated crop of a missing image:

DivisionByZeroError: Division by zero in Drupal\automated_crop\AbstractAutomatedCrop->setAspectRatio() (line 222 of modules/contrib/automated_crop/src/AbstractAutomatedCrop.php).

Drupal\automated_crop\AbstractAutomatedCrop->initCropBox() (Line: 108)
Drupal\automated_crop\AbstractAutomatedCrop->__construct(Array, 'automated_crop_default', Array) (Line: 117)
Drupal\automated_crop\AbstractAutomatedCrop::create(Object, Array, 'automated_crop_default', Array) (Line: 21)

Proposed resolution

Add a check for the width and height of the image being 0.

πŸ› Bug report
Status

Active

Version

9.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024