Skip to content
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

Module Proposal: Check if image sizes set via code match the actual image sizes #470

Closed
pbearne opened this issue Aug 10, 2022 · 9 comments
Labels
Needs Discussion Anything that needs a discussion/agreement [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only

Comments

@pbearne
Copy link
Contributor

pbearne commented Aug 10, 2022

Overview

  • Proposed module name: Image Sizes Validator
  • Proposed module slug: image-size-validator
  • Proposed module owner GitHub username(s): pbearne

About the module

Purpose

themes and plugins set what image sizes should be created when an image is uploaded
This module would validate that actual files on the site match the values set
and links to the function to rebuild if they don't

Scope

not planning to look at the actual file size but just check using the filenames

Rationale

We don't yet have the rebuild function in core so this health check should follow that into core

Other

@mxbclang
Copy link
Contributor

Thanks @pbearne!

We don't yet have the rebuild function in core so this health check should follow that into core

Can you confirm that this would be a Health Check, or a non-Health Check module? And can you confirm that the "rebuild function" that you're referring to is #24?

cc @felixarntz @adamsilverstein for visibility

@pbearne
Copy link
Contributor Author

pbearne commented Aug 11, 2022

Yes, this would be a health check module

If WP doesn't find the image size requested it has to find and sent the next size up
So having the right size is a performance boost.

And yes #24 is the rebuild project for this to be linked to.
It would flag that is needs to run

@mxbclang mxbclang added [Focus] Site Health Needs Discussion Anything that needs a discussion/agreement labels Aug 11, 2022
@mxbclang
Copy link
Contributor

@pbearne Got it, thank you! Since #24 is still being defined, we likely won't be ready to move on this module proposal for some time. I'm going to keep this in the Backlog for now and we can discuss in a future chat as we get a little closer to that module being ready.

cc @jjgrainger @ankitrox

@mxbclang mxbclang changed the title Module Proposal: Check if the images sizes set via code match the actual images sizes Module Proposal: Check if image sizes set via code match the actual image sizes Aug 17, 2022
@mxbclang
Copy link
Contributor

mxbclang commented Nov 9, 2022

@pbearne Heads up that with the removal of WebP from core, #24 has been put on hold indefinitely, so we can't move forward on this module proposal at this time. Keeping it open and in Backlog for future consideration.

@adamsilverstein
Copy link
Member

@pbearne Heads up that with the removal of WebP from core, #24 has been put on hold indefinitely, so we can't move forward on this module proposal at this time. Keeping it open and in Backlog for future consideration.

I still feel like this could be a useful module because it informs users their sizes are not set correctly. We can point to the canonical "regenerate thumbnails" plugin (or a plugin search for that phrase) to help users fix the issue

@adamsilverstein
Copy link
Member

This module would validate that actual files on the site match the values set
and links to the function to rebuild if they don't

@pbearne curious how you were thinking this could be accomplished. For sites with many media items, scanning every image would be costly. A scalable approach might be to only look at the oldest X images to check for correct sizes, or use a sampling approach. Neither would be completely accurate, but would still catch most cases.

What do you think?

@mxbclang mxbclang added Needs Dev Anything that requires development (e.g. a pull request) Needs Discussion Anything that needs a discussion/agreement and removed Needs Dev Anything that requires development (e.g. a pull request) Needs Discussion Anything that needs a discussion/agreement labels Nov 29, 2022
@pbearne
Copy link
Contributor Author

pbearne commented Nov 29, 2022

As I was planning to look at the file names, we could grab a few folder blobs loop to strip the filename to leave the size string and then add if different.
I like the idea of just sampling, starting with the oldest

? are we going to look for images that are not needed or/and check all images we have the image sizes we need for the current theme/setup

We can stop looking once we find a mismatch we don't need a list of all the dif just to know an image is wrong.

@felixarntz felixarntz added the [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only label Jul 19, 2023
@swissspidy
Copy link
Member

@pbearne Heads up that with the removal of WebP from core, #24 has been put on hold indefinitely, so we can't move forward on this module proposal at this time. Keeping it open and in Backlog for future consideration.

I still feel like this could be a useful module because it informs users their sizes are not set correctly. We can point to the canonical "regenerate thumbnails" plugin (or a plugin search for that phrase) to help users fix the issue

Since modules were now split into individual plugins, now it doesn't make much sense to create a standalone plugin that does only little work and then points to another plugin.

With that, and #24 not planned anymore, I would also suggest closing this ticket here as a wontfix.

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2025
@westonruter
Copy link
Member

If I understand this issue correctly, this brings to mind something for Image Prioritizer. Given a page that has collected URL Metrics which include the dimensions for the images used on the page, a background process could generate tailored image sizes for how an image is actually used. Note that the URL Metric data may also need to capture the window.devicePixelRatio so that this can be factored into the equation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Anything that needs a discussion/agreement [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only
Projects
None yet
Development

No branches or pull requests

7 participants