-
Notifications
You must be signed in to change notification settings - Fork 109
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 image sub-sizes in additional MIME types using sources
for storage.
#147
Create image sub-sizes in additional MIME types using sources
for storage.
#147
Conversation
The property is added to every single image size available, each value inside the properties array is a reference to a different image mime type. If the image size was created as a JPEG version a WebP version would be created, if a WebP version exists a JPEG version would be created instead based on the details from ticket #142 This mechanism would allow extending the sources properties for more additional mime types. The value for each mime type is an associative array with `file` as the only property for now. And the plan is to include more meaningful properties such as `filesize` to a different mime type.
Make sure file follows the standard from `phpcs`
Prevent to use numeric indexes for each image size, instead use the correct image name.
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 This looks like a good start, however there are a couple things that need to be refined. I left some comments.
Summarizing a chat conversation on this between @mitogh, @adamsilverstein and myself:
|
Use a function that already exists in core, no need to define a new function if core already provides this information.
Based on feedback on code review hooks where moved closer where the callbacks for each is defined.
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
…om:WordPress/performance into feature/142-multiple-mimes-for-image-sizes
Make sure function is only called once, due `wp_get_registered_image_subsizes` does not return a function.
This class is no longer required or used in the set of tests, so there's no real value in keeping the class in place.
The added images are going to be used as part of the tests suite.
The `load` method is required by the editor to process an image.
The result of the conditional can be used instead.
For every single image size a new mime type would be created if the original mime type of the image supports the specified mime type. Currently this only works with: `image/jpg` and `image/webp` and vice-versa. Only for all the available image sizes except the full size image. This PR fixes: #142, #8
When an attachment is deleted all the generated WebP versions of an attachment should be removed when the main attachment is removed.
Make sure the file follows the same format as the rest of the project by following the same guidelines.
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 I left a few last nit-pick comments. Other than those, the one critical thing here is that I still think the cron usage isn't really appropriate here, since we should tie into WP core behavior, which doesn't have that. See my comment https://github.com/WordPress/performance/pull/147/files#r813258590 for more details.
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Move the WebP image generation into a single process instead of creating individual cron for each image.
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.
Excellent work!
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 All great now! Except can you please replace all the remaining usages of array_key_exists
here with isset
as outlined before?
Use `isset` as we are just interested if the key exists even if is `null`
Sure @felixarntz just updated the code based on your feedback. |
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.
sources
property to each image sizesources
for storage.
I see a lot of these issues are merged and closed and I'm not sure where the trail ends. Was this ever introduced into a release? |
Hi @christianmagill! The easiest way to tell if a PR/issue was released is via the Milestone field in the right sidebar – this was included in v1.0.0. |
Much thanks Bethany!
Christian Magill
…On Wed, Jun 8, 2022 at 3:27 PM Bethany Chobanian Lang < ***@***.***> wrote:
Hi @christianmagill <https://github.com/christianmagill>! The easiest way
to tell if a PR/issue was released is via the Milestone field in the right
sidebar – this was included in v1.0.0.
—
Reply to this email directly, view it on GitHub
<#147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQI26SJ5GYQ2VSOXMPELR3VODXYXANCNFSM5NNU7EHQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Summary
The property is added to every single image size available, each value inside the properties array is a reference to
a different image mime type.
If the image size was created as a JPEG version a WebP version would be created, if a WebP version exists a JPEG version
would be created instead based on the details from ticket #142
This mechanism would allow extending the sources property for more additional mime types.
Fixes:
Relevant technical choices
Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.