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

Unexpected behaviour when new size is larger than full image #86

Open
smerriman opened this issue Sep 9, 2019 · 4 comments
Open

Unexpected behaviour when new size is larger than full image #86

smerriman opened this issue Sep 9, 2019 · 4 comments

Comments

@smerriman
Copy link

Suppose a site has post thumbnails set to 200x200; I change this to 600x600 and regenerate thumbnails (telling the plugin to skip correctly sized images).

If after doing so, I upload a new 400x400 image, the post-thumbnail size won't get created in the metadata (since it is too small), so when the theme calls the_post_thumbnail(), it will output the full 400x400 image.

However, if a 400x400 image was uploaded prior to regeneration, when the theme calls the_post_thumbnail, it will output the original 200x200 image.

This is because the plugin is skipping the thumbnail size ('thumbnail would be larger than original'), but leaving the old size in the metadata, rather than removing it.

I believe removing it would be the logical behaviour.

@alexsanford alexsanford added the [Status] Queued In the queue of issues to work on next. label May 1, 2020
@ddur
Copy link

ddur commented May 13, 2020

AFAIK, WP 5.3 and above will clear all metadata[sizes] on upload and on regenerate

@smerriman
Copy link
Author

No, this is nothing to do with the WP version (it would in fact be very bad if it cleared the metadata in general, since it's often important to have unregistered sizes).

@smerriman
Copy link
Author

smerriman commented May 14, 2020

This is a bug report for the Regenerate Thumbnails plugin. It adds the sizes back in after calling the core WordPress function:

https://github.com/Automattic/regenerate-thumbnails/blob/master/includes/class-regeneratethumbnails-regenerator.php#L199

As mentioned, adding these sizes back is a vital part of the plugin - for example, at the point you upload a Site Icon to WordPress, it adds some square sizes to the metadata unique to that image so that it doesn't need to register a size and have it generated for your entire Media library. If these weren't readded, Site Icons would break after using this plugin.

So that section of the code shouldn't be removed; unregistered sizes should be re-added, but registered sizes - which may not exist in the new metadata due to the fact the original image isn't large enough - shouldn't.

@gikaragia gikaragia removed the [Status] Queued In the queue of issues to work on next. label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants