vollyimnetz/crop-thumbnails

Getting the attachment ID in the `crop_thumbnails_after_save_new_thumb` action

Closed this issue · 1 comments

Thanks for the plugin!

I need to get the attachment ID after an image is cropped. The crop_thumbnails_after_save_new_thumb action looks like the best hook, but I don't see a way to get the attachment ID. I quickly modified the code in save.php to add an additional parameter to the updateMetadata function called $imageId and included that parameter in the crop_thumbnails_after_save_new_thumb action.

Is there a better way to accomplish this? I'd prefer to keep the plugin as-is if possible. Thanks again for the plugin!

You can use the crop_thumbnails_before_update_metadata filter which uses the imageMetadata and the sourceImageId.