WordPress / performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
https://wordpress.org/plugins/performance-lab/
GNU General Public License v2.0
367 stars 101 forks source link

Modern Image Formats: Option to delete the original file on upload #1564

Open JosVelasco opened 1 month ago

JosVelasco commented 1 month ago

Hi team:

To save disk space, add an option to the settings to delete the original JPEG / PNG.

The file could also be named filename.avif instead of, for example, filename-jpg.avif.

The downsize that I image could be that for images that need to be .jpg or .png for applications like og:image, you'd have to temporarily turn off the option.

AhmarZaidi commented 1 month ago

Hey 👋, I'd like to work on this issue!

AhmarZaidi commented 1 month ago

Hey Team,

Created a PR for this issue: https://github.com/WordPress/performance/pull/1606

felixarntz commented 1 month ago

Is this something we want to encourage? By providing a UI control, we send a signal that this is one of the encouraged ways to configure the plugin, and I wonder whether that's justifiable.

WordPress Core always keeps the original image, even when it's not used as the full size, and I'm not sure we want to break with this pattern. One of the reasons is that many sites need those full-resolution images, e.g. photography sites may want to link to them.

More importantly though, why should a Core feature plugin like this provide an option for something that Core doesn't provide an option for? In other words, the decision whether to keep the original image is just as relevant for Core as it is for this plugin, so this plugin doesn't feel like the right place to add an option for this.

@JosVelasco I wonder if there's already a filter in WordPress Core to modify the behavior. If not, we may want to introduce one. That would make more sense to me than implementing it in this plugin specifically (which would mean that Core would remain unaffected, leading to inconsistent behavior).

@adamsilverstein @westonruter Curious what you think about this.

westonruter commented 1 month ago

I also doubt whether we should facilitate deleting the original file.

JosVelasco commented 1 month ago

At some point, we are moving from a decisions-not-options paradigm to a more options one; at least, that is what I see with the Site Editor and its more advanced options, like the fonts manager. The filter sounds great, tho. I still think most users won’t touch it.

adamsilverstein commented 2 weeks ago

At some point, we are moving from a decisions-not-options paradigm to a more options one

It is fine to add an option in a plugin, but I also question the usefulness/advisability of this feature.

I also doubt whether we should facilitate deleting the original file.

I agree. The original image is considered user data and for that reason we should probably preserve it. If the user installs a new theme with additional image sizes, they may want to generate those sizes for existing uploads. Without the original upload this is not possible. Even if we kept a modern format copy of the original, we wouldn't want to use that as the new source because compression artifacts would become amplified.

To save disk space, add an option to the settings to delete the original JPEG / PNG.

If users generate AVIF or WebP instead of JPEG sub sizes we are already saving them significant storage space. Removing the original upload would save additional space, however is that really an issue for users?

For users that really want to delete their original uploads, this is already achievable using existing hooks, or using a plugin purpose built for this like https://wordpress.org/plugins/delete-original-image/

I would suggest we close this ticket after some time for additional discussion.