• Resolved keyuroz

    (@keyuroz)


    I have not enabled “Backup original images’ and still I see that there are images that were converted to webp in the original folder but not deleted.

    I want to reduce the diskspace and just wondering if it is possible to remove the original images from the folder (the one WP automatically creates every month e.g. 07 in 2021 folder – meaning the images uploaded in the month of July in 2021)

    Does this plugin actually deletes the images in the original folder. I am not referring to the backup folder created by Imagify.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP Media

    (@wp_media)

    Hi @keyuroz

    Thank you for contacting us!

    Please note that Imagify can keep the original version of the image saved only in the following location wp-content/uploads/backup and if you have the option “Backup original images” enabled through Settings > Imagify.

    To answer your question, Imagify will not delete the images in the original folder. Those images are not saved from Imagify but from WordPress and unfortunately, there is no option on Imagify not to save them.

    Let me know if you need further assistance. I’ll be happy to help.

    Best Regards,

    Ioanna

    I have the same issue :/ Bought imagify infinite because I thought this would solve it.

    I have a bbPress installation that receives around 50 images per day, which can be well over 100mb. Imagify solves the problem of showing optimized versions to the visitor, but it doesn’t solve the issue of them filling up my server. What can I do to prevent that?

    This function seemed to solve it

    function delete_original_image_after_upload($metadata) {
    $upload_dir = wp_upload_dir(); 
    // Construct the path for the real original image
    $original_file_path = $upload_dir['basedir'] . '/' . $metadata['file'];
    
    // Remove sizes suffixes, including the 'scaled' version
    foreach ($metadata['sizes'] as $size => $size_data) {
        $suffix = '-' . $size_data['width'] . 'x' . $size_data['height'];
        $original_file_path = str_replace($suffix, '', $original_file_path);
    }
    
    // Remove the -scaled suffix just in case
    $original_file_path = str_replace('-scaled', '', $original_file_path);
    
    // Check if the remaining file path exists (which should be the real original)
    if (file_exists($original_file_path)) {
        unlink($original_file_path); // Delete the original file
    }
    
    return $metadata;
    }
    
    add_filter('wp_generate_attachment_metadata', 'delete_original_image_after_upload');
    
    Plugin Author WP Media

    (@wp_media)

    Hi @markus9312 ,

    Thank you for contacting us!

    Let me clarify that the scaled images are created when an image is uploaded which is wider/taller than 2560px, so WordPress (starting from v5.3) will create “-scaled” version (the one scaled to 2560px) but will keep the original as it is needed if image is edited, WebP is created or similar action. WP will also add two additional thumbnails in that case and that definitely can cause the disk space issues.

    You can disable this behaviour from WP by using this plugin – https://www.ads-software.com/plugins/disable-big-image-threshold/

    And it should help you.

    Let me know if you need any further assistance, I am happy to help.

    Best Regards,

    Ioanna

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Delete Original Images After WebP Conversion’ is closed to new replies.