Original images are being deleted after saving a crop

Created on 21 March 2024, 9 months ago
Updated 12 April 2024, 8 months ago

Problem/Motivation

I discovered this issue in Bunny Optimizer, another module that shares the same structure with this one. It's probably also relevant here, but is only triggered when using certain contrib modules, so not everyone will encounter this.

Drupal\crop\Entity\Crop::postSave() calls image_path_flush(), which in turn is supposed to delete all image derivatives. When using this module, image derivatives are the original image with some query params, which means that the original image is deleted when flushing image derivatives. Yikes.

Proposed resolution

Add Drupal\imgix\Entity\ImgixImageStyle::flush and make it a stub, not doing anything. Image derivatives don't need to be flushed in our case. We could invalidate the CDN cache, but that would introduce a lot more complexity, this is good enough for now.

🐛 Bug report
Status

Fixed

Version

2.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