• dowista

    (@dowista)


    Hello. I have selected option: Delete Originals??This will remove the original image from the server after a successful conversion.

    After image upload, image are scaled by default wp, then converted to webp, but original not deleted.

    https://i.ibb.co/Y22TNj0/Capture.jpg

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter dowista

    (@dowista)

    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 );

    Plugin Support adamewww

    (@adamewww)

    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.”

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.