add_filter( 'image_size_names_choose', array
( $wp_site_icon, 'additional_sizes'
) );
break;
} /** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped =
apply_filters( 'wp_create_file_in_uploads',
$cropped,
$attachment_id ); // For replication.
$attachment =
$wp_site_icon->
create_attachment_object( $cropped,
$attachment_id );
unset( $attachment['ID'
] );
// Update the attachment.
add_filter( 'intermediate_image_sizes_advanced', array
( $wp_site_icon, 'additional_sizes'
) );
$attachment_id =
$wp_site_icon->
insert_attachment( $attachment,
$cropped );
remove_filter( 'intermediate_image_sizes_advanced', array
( $wp_site_icon, 'additional_sizes'
) );
// Additional sizes in wp_prepare_attachment_for_js().
add_filter( 'image_size_names_choose', array
( $wp_site_icon, 'additional_sizes'
) );
break;
default:
/**
* Fires before a cropped image is saved.
*
* Allows to add filters to modify the way a cropped image is saved.
*
* @since 4.3.0
*
* @param string $context The Customizer control requesting the cropped image.
* @param int $attachment_id The attachment ID of the original image.
* @param string $cropped Path to the cropped image file.
*/