Closed victormattosvm closed 1 year ago
@victormattosvm why was the "crop_thumbnails_before_update_metadata" filter not suitable?
@victormattosvm why was the "crop_thumbnails_before_update_metadata" filter not suitable?
Hello @vollyimnetz Because this filter runs after the loop, sending all the attachment metadata, not just the image size being cropped. I needed to append metadata only for the active image size after the crop and after the metadata was generated.
@victormattosvm thank you for your contribution. I just want to let you know: the filter will be in for version 1.7.0 - but there will be slight changes, to make it more versatile. You shouldn't have much trouble to adapt your code.
From the upcoming documentation:
crop_thumbnails_after_save_new_thumb
This filter is called for every image-size after the crop of the image has been performed. It contains all of the modified metadata. With $imageMetadata['sizes'][$imageSizeName]
you may access the last changed value.
Parameters:
$imageMetadata
(filter result)$imageSizeName
$currentFilePathInfo
$croppedWidth
$croppedHeight
$croppingInput
- you may want to use $croppingInput->sourceImageId
Cool! Thanks @vollyimnetz Even better.
This filter allows changing the generated metadata of the cropped file.
It was useful for me when I needed to append metadata for the active size right after cropping.