-
Notifications
You must be signed in to change notification settings - Fork 107
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
Create additional MIME types for the full size image. #194
Conversation
Make sure the variable is closer to the place where is going to be used.
Add a sources property for the full size image and stored in a sources property. This property would create an image with the full size dimensions of the image uploaded into the media library.
Make sure the file follows the `phpcs` rules.
Add the removal of the `sources` property for mimes different from the original image. The function would ensure to remove any remaining image is removed.
Add an edge case when the image sizes are not defined we need to make sure all original images are removed as part of the files removed instead of returning early when no sizes are present.
Co-authored-by: Adam Silverstein <adamjs@google.com>
Merge the 2 hooks in charge of creating the full size images with thes sources property of all the image sizes in a single function.
🎉 This worked well in my testing, even with a resource constrained system where multiple retries were required. |
Co-authored-by: Adam Silverstein <adamjs@google.com>
…rformance into feature/174-full-image-size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitogh Left another reply on #194 (comment), I think that point is still valid.
The other changes lgtm, however note that linting is currently failing, so something will need to be fixed there.
Split and share the logic to generate the `full` size image with the subsizes for all images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a bit more feedback here. Mostly lgtm, however there are a few inconsistencies. Most importantly, we shouldn't get this PR mixed up with what the separate issue #204 is intended for.
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Due the original image change is part of a different PR, to keep each PR separate.
In order to ensure all the required parameters are passed down when calling this function.
…rformance into feature/174-full-image-size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitogh A few additional nit-picks, but it's close. My main open question is still https://github.com/WordPress/performance/pull/194/files#r823007963 though, that would be great to clarify.
The conditional and the usage of a fallback value is not required
An image should contain a positive number to be considered a valid dimensions.
Add tests to cover additional scenarios handled in the function `webp_uploads_generate_additional_image_source`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitogh Just one more comment based on the newly added code, and I also left a reply to #194 (comment) where I think we still should centralize the validation instead of checking outside of the filter function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
full
size image.
Summary
Fixes #174
Relevant technical choices
The following PR introduces a
sources
property at the root of the metadata with all the information for every single mime type, in this casefile
andfilesize
.The PR introduces a mechanism to remove the additional files created by the plugin
Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.