Hook after image is uploaded and image sizes generated

Is there any hook that fires once the image is uploaded and the image sizes generated?

wp_handle_upload fires after the image is uploaded. After the follow-up question, I discovered that images would not be sized at this point.

add_filter( 'wp_handle_upload' 'wpse_256351_upload', 10, 2 );
function wpse_256351_upload( $upload, $context ) {
  //* Do something interesting
  return $upload;
}

Added:

Images are resized on line 135 of image.php. There are no hooks in method to resize the images.

At the end of the wp_generate_attachment_metadata() function, wp_generate_attachment_metadata fires. This is after the image sizes are generated.

wp_read_image_metadata is another option. It fires before wp_generate_attachment_metadata but after image sizes are generated.

Leave a Comment