• Hi,
    can I ask for help, or if someone has already dealt with it, to point me in the right direction. Is it possible to delete the original images in a reasonable way somewhere, after wordpress has resized them to the maximum system size after uploading. This is the removal of the image, see the attachment. Yes I can remove it via FTP, but in the media this line “Original image:” will remain. Moreover, it is extremely inefficient work. There is no option to add a button here, delete Original file, which would delete the file “extremely-large-image.jpg” and other files with previews and sizes “extremely-large-image-scaled.jpg /full/medium/large etc ” would remain unaffected.
    Thank you very much in advance for your help. It would save me tens, maybe hundreds, of hours of work.

    https://www.3dfo.cz/images/wp/delete-original-img.jpg

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    There could be a plugin that offers such a feature. It’d be worth doing some searching before developing a bespoke solution.

    One could hook the ‘wp_generate_attachment_metadata’ filter and manipulate files accordingly (and any related metadata when necessary). We should not however blindly delete any original file. Not all uploads are way over sized and unusable. Not all media are even images. Establish valid criteria for deciding to delete the original and incorporate it into the deletion algorithm.

    Thread Starter Roice

    (@roicecz)

    Thank you, unfortunately I don’t have enough experience to develop such a plugin. In any case, if someone wanted to get involved, then a button in the media detail would really be enough to remove the original file from the database and physically from the server.
    As for the file tip, I’m just guessing, but I think wordpres keeps this particular original file only after changing extremely large image files (jpg, png etc..), for which it creates a copy with a maximum size of 2560x2560px. The original file is then not used for anything. This leaves dead data on the server. Then all it takes is an individual, one distracted editor who doesn’t check the uploaded files and you have hundreds of MB or GB of dead data on the server that is very difficult to remove. I’m currently solving this on a website where there are 16k source images and it’s really extremely bad.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Delete Original large image after sys. resize’ is closed to new replies.