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

Media regeneration issue #3859

Closed
ivankruchkoff opened this issue Mar 1, 2017 · 4 comments
Closed

Media regeneration issue #3859

ivankruchkoff opened this issue Mar 1, 2017 · 4 comments

Comments

@ivankruchkoff
Copy link

It seems that the following fails when you regenerate thumbs for an image which has a dimension smaller than a registered image size:
wp media regenerate --yes --only-missing

We have two test images, a) 1000x1000 b) 627x362.

we register a size of 400x400
We fetch via media_sideload_image

When we call:
wp media regenerate --yes --only-missing

It will always regenerate the thumbnails for b) due to:

wp eval 'print_r(array_diff( get_intermediate_image_sizes(), array_keys( wp_get_attachment_metadata(111)['sizes'] ) ));'
Array
(
[1] => medium
[2] => medium_large
[3] => large
)

1 = 400x400, 2=512x512, 3=768x768
This arises in https://github.com/wp-cli/wp-cli/blob/master/php/commands/media.php#L375

@szepeviktor
Copy link
Contributor

szepeviktor commented Mar 3, 2017

when you regenerate thumbs for an image which has a dimension smaller than a registered image size

Do you mean the 627x362 image is smaller than 400x400?

*I see! 362 < 400

@ivankruchkoff
Copy link
Author

Correct :)

ivankruchkoff pushed a commit to ivankruchkoff/wp-cli that referenced this issue Mar 6, 2017
@ivankruchkoff
Copy link
Author

Put out a PR for the issue: #3879

@danielbachhuber
Copy link
Member

I think this is actually because thumbnail isn't included as an image size in get_intermediate_image_sizes()

I've ported this issue over to the new repository for wp media *: wp-cli/media-command#2

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

3 participants