backdrop-contrib / manualcrop

The Manual Crop module exposes a set of image style effects that allow you to crop (and scale) an image after uploading.
GNU General Public License v2.0
1 stars 1 forks source link

Issue after renaming a base image style #10

Closed ghost closed 6 years ago

ghost commented 6 years ago

When an image style uses the 'Manual Crop: Reuse cropped style' effect, and the base image style it references is renamed (the machine name is changed), you get a white screen (error) when trying to edit the image style and the following error in the log:

Warning: reset() expects parameter 1 to be array, null given in manualcrop_reuse_effect() (line 867 of /[SNIP]/modules/manualcrop/manualcrop.module).

Adding this code immediately after the $style = image_style_load($data['reuse_crop_style']); line in the manualcrop_reuse_effect() function fixes it:

if (!$style) {
  return FALSE;
}
laryn commented 6 years ago

@BWPanda how did you change the machine name -- in the database directly?

ghost commented 6 years ago

No, you can change the machine name using the 'Edit' link to the right of the 'Image style name' field. Note however that this only works for image styles you've created yourself, not the core ones.

laryn commented 6 years ago

Got it. Yes, then we'd better account for it! Thanks.