WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

Consider adding a “revert to original” button after altering or cropping an image #43882

Open annezazu opened 2 years ago

annezazu commented 2 years ago

What problem does this address?

The ability to quickly get back to the original state of an image after making alterations. This came up in the sixteenth call for testing for the FSE Outreach Program:

I cannot remove a crop on an image, only replace it with the original from the media library. I would like to be told a new image was created. It would be nice if the image block would be smart enough to have a “revert to original” button and know which image in the media library to revert to.

What is your proposed solution?

In the same way there's an option to turn on/off a duotone filter, it would be neat to have a way to undo cropping to set things back to how the image originally was, perhaps both while still cropping and after the fact. I understand that this is likely complicated by the fact that a new image is created post cropping so I'm not sure if this is technically improbable/impossible. When thinking about current and future possibilities for altering images, being able to get back to an original/clean state will be important to figure out rather than expecting folks to rely on clicking the undo button or manually unsetting each feature: https://github.com/WordPress/gutenberg/issues/23721 cc @jasmussen who I know has thought a lot about this area of work!

The lighthouse app offers a "reset" option for inspiration: IMG_2415 IMG_2416

jasmussen commented 2 years ago

Good ticket, thanks for the ping!

When an image gets cropped, a copy of the original image gets saved. I.e. my-photo.jpgmy-photo-edited.jpg. Which means, beyond pressing "undo" in a single editing session, if we were to build a revert to original button, presumably all we'd have to go on to know an image had been edited, is the -edited suffix from the filename. If we can contextually show a revert button (perhaps in the inspector under dimensions) which when clicked would revert the image back to the un-suffixed version, then it seems feasible.

Where this gets a little gnarly, is that -edited is a pretty generic suffix, and a suffix that a photographer might likely use on their own volition without first going through image tools. In this case, a revert button might show up even though there isn't any original to revert back to! This is where the effort to build such a button might go from "small fix" to a great deal of potential complexity, which might not be worth it. In other words: would this tradeoff be acceptable in the name of keeping this simple?

Alternatively, I'm pretty convinced that https://github.com/WordPress/gutenberg/issues/38990 can bring some pretty great options to the Image block in terms of masking instead of cropping:

uncrop

In the case of a masked image (perhaps an image from a pattern that was preset with custom dimensions and masking), reverting to the original would be a matter of pressing the "unmask" button in the inspector.

Mamaduka commented 1 year ago

We can make the "Revert/Reset" part of the snack bar notice - #22573. Would that work?