-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform updates on secondary image mime types when original image is edited #158
Comments
Thanks for opening this @mitogh - we absolutely need to make sure all these function work as expected with the additional mime types. It makes sense that we would want to create crops for each mime format the image was stored in. I'm interested in investigating how editing interacts with the idea of storing the additional mime types as backup images, once your POC is further along I will test that. |
Thanks, @adamsilverstein just updated the original PR to address this use case as well: Let me know in case you have any additional feedback. |
Great question @bethanylang yes #154 was closed due we are using a different mechanism now, the work for this ticket still needs to be implemented as the previous #154 was using an approach that at the end was not used. #147 only has a foundation when an image is uploaded, the work remaining for this ticket is to make sure the same structure is followed when an image is edited. I've updated the labels for this ticket to indicate the correct status and removed my assignment in case someone else wants to take over it, in case no one has the allocation to work on this I can try to get it back next week. |
Noting that @kirtangajjar is taking this one on, but we've having some permissions issues that aren't letting me assign him. I'm working with the meta team to clear this up. |
Noting that this has been split into two issues: this issue, to generate secondary images with edits; and #228, to update restore and backup image sizes with sources for edited images. |
Thank you @kirtangajjar for getting this draft PR and for your work on this one. Let me take a quick look so I can provide some earlier feedback. |
This would be handled once #158 is merged so the current approach can be adjusted accordingly.
@mitogh You were mentioning you already started a follow-up PR to better support the individual targets for editing images. Could you also create a separate follow-up issue for that? So we can consider this one complete? Particularly because this here is gonna go in the upcoming release, while the other one probably won't be ready in time. |
Scenario
When an image is uploaded into WordPress at least 2 mime types would be created according to with:
After the image completes the update into the media library, the image would be stored using at least 2 mime types, for this scenario let's use:
image/webp
image/jpeg
For simplicity, we are going to call
webp
the primary image format andjpeg
the secondary image format.After an image is uploaded edits can be performed against this image, when using the image editor (see attached image) or from within the Gutenberg editor.
After an edit is performed in the original image the original sizes are stored inside of
_wp_attachment_backup_sizes
and the files preserved to allow a restore of the files in case required. Subsequent edits (if more than a single update is performed) would be stored in the_wp_attachment_backup_sizes
keeping_wp_attachment_metadata
data with the last edit so the image always reflect the last action performed by the user.Recreate image in secondary image format for every edit
For every edit performed on the original image, a primary image format would be stored (WordPress default behavior).
So the questions come into place: Should the secondary image format recreate the same edit format and keep the original secondary format the same way it happens with the primary image format.
This behavior is consistent with the primary image format. In case an image is requested with the secondary format the image would be displayed in the same way as the primary image format.(with the edits applied to the original image)
Notes
e-$id
where$id
is a13
digit number specificallytime() . rand( 100, 999 )
created by WP to reference any additional edit that is no longer relevant, the file name is important so WP can identify images that reference to edits and can be removed accordingly based on the definition and value ofIMAGE_EDIT_OVERWRITE
This suffix is also included as part of the image size name.The text was updated successfully, but these errors were encountered: