-
Notifications
You must be signed in to change notification settings - Fork 138
Description
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/webpimage/jpeg
For simplicity, we are going to call webp the primary image format and jpeg 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.
- rotation
- flip
- crop
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
- Image edits should include the suffix
e-$idwhere$idis a13digit 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_OVERWRITEThis suffix is also included as part of the image size name.
