Image crop set with no width and height

Created on 1 November 2023, about 1 year ago
Updated 6 March 2024, 8 months ago

Problem/Motivation

If a user doesn't set a crop or removes a crop by clicking on the image, the stored crop data is set so that x == x2 and y == y2 based on the click position.

This results in the widget trying to create an image crop for a zero width and height on the node edit form, resulting in a fatal error.

DivisionByZeroError: Division by zero in image_dimensions_scale() (line 204 of /app/includes/image.inc).

Steps to reproduce

Click on the image to deselect/remove the crop.
Save the node.
Edit the node (you will see a fatal error). - tested in PHP8.1

Proposed resolution

Check the crop data, so that it falls back to the original image size.

Remaining tasks



Review & Tested by the community.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom jefflogan

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

Comments & Activities

Production build 0.71.5 2024