if someone need delete original after scale, i have found solution:
just in your themes functions.php file put this code:
function delete_unscaled_upload( $metadata, $attachment_id ) {
if ( ! empty( $metadata['original_image'] ) ) {
$upload_dir = wp_upload_dir();
$original_image = path_join( dirname( $metadata['file'] ), $metadata['original_image'] );
$original_file = path_join( $upload_dir['basedir'], $original_image );
if ( unlink( $original_file ) ) {
unset( $metadata['original_image'] );
}
}
return $metadata;
}
add_filter( 'wp_generate_attachment_metadata', 'delete_unscaled_upload', 10, 2 );
Hi @dowista
The option in the plugin settings Convert tab for “Delete Originals” is only for deleting the original JPG or PNG that has been converted to a PNG or a JPG (in whichever order). It does not delete the original oversized image that WordPress has set aside and provided a “-scaled” version for.
That having been said, there is a button option in the Tools->EWWW IO menu that does what you would like to delete those oversized leftovers. It is labeled “Delete Originals” and the text for it states: “When WordPress scales down large images, it keeps the original on disk for thumbnail generation. You may delete them to save disk space.”