-
Notifications
You must be signed in to change notification settings - Fork 41
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
Regenerate with --image_size deletes all other sizes from postmeta #130
Comments
I get same problem. |
I think I've stumbled upon the same problem. In my case I've noticed that responsive images stopped working after I regenerated a particular image size. Since the other sizes are not included in meta, wp_calculate_image_srcset only outputs |
I get the same error. |
Can confirm. Here is an example: Start with image that already is correct. Now, if you run If you use the Running |
i have had the same issue.. i can confirm that running the command |
I can confirm this problem. |
Above PR #141 (hopefully) fixes the issue. |
I can confirm this issue too. The workaround without image_size and --only-missing does not work for me. All image sizes will be recreated on disk again with this workaround. I tried also the workaround from thomasmb, but this does the same. Not only the array will be touched, also the files on disk will be recreated. |
Thanks @mklepaczewski Is it possible to merge #141 ? |
I've just run into this issue too! @schlessera Would it be possible to get this into v2.5.1? |
@danielbachhuber Yes, I can look into including that. The current PR is still missing tests, though. |
I've run into the same issue as well. |
Please note that I'm not part of the wp-cli team, I merely added the pull request to fix the issue. Yes, you can fix it. You can hire someone on Upwork to write missing Behat tests and push the fix forward. Or ask your in-house devs to do it. Surely it's cheaper than losing another 1 million images due to the issue. I apologize for being snarky, but... Multiple people reported the issue, some of you must have developers on the payroll. No one decided "hey, maybe let's spend 2-3 hours of our development time on pushing forward the issue that is so irritating to us". |
Has anyone found a method of populating the missing meta data without running regenerate command for all images? |
Hello, I have the same problem, i would debug this part but i don't known how. I have read this : https://make.wordpress.org/cli/handbook/contributions/pull-requests/#setting-up Regards |
With success I do some tests, but i didn't fix the problem but it can help, i can't spend all my time on this bug but : The function process_regeneration take the --image_size parameter but the filter is put in the previously function. https://developer.wordpress.org/reference/functions/wp_generate_attachment_metadata/
When i will get more time i could try to fix it, but if someone can look at this first ? Regards |
Hi, Nobody to help me to try to fix this ? Regards |
Pulling in the diff from #141: https://gist.github.com/danielbachhuber/9ce0653b91faa5151882b149fca38d02 It doesn't seem like its tests currently pass, however...
|
OK thanks, when i will terminate my other project, i will try to do some modifications on this code, but could you confirm what i found please ? Regards |
@danielbachhuber I'm going to check this one. |
@danielbachhuber I've opened a PR for the failing test: #169 The tests from https://gist.github.com/danielbachhuber/9ce0653b91faa5151882b149fca38d02 succeed when I apply this diff on top of my PR. I will review the fix more and will add a separate PR for that. |
I've created a PR (#170) with the fix from the linked gist and it fixes the issue - Behat tests go through, I tested it manually in stand-alone WP as well. |
For posterity, it looks like this bug might've been introduced with WordPress 5.3 (November 2019): WordPress/wordpress-develop@ca84ae5 Specifically, |
Is there a chance this has been reintroduced? I have had meta mysteriously go missing after a --only-missing --image_size. Running 2.6.0. |
Update your WP-CLI instance. Current version is 2.10, version 2.6.0 has been released more than two years ago... |
Bug Report
--- ✅ If you are in the correct location now... --->
Describe the current, buggy behavior
I changed the height/width of an image size and tried to regenerate only the thumbnails for this specific size with
--image_size=medium
Here my full command:wp media regenerate --image_size=medium --skip-delete --only-missing
After the regeneration, the REST API showed only
medium
under sizes. I checked thepostmeta
database table for the_wp_attachment_metadata
and it seems like, that_wp_attachment_metadata
now only contains the regenerated size, all other are gone:If I run the command without
--image_size
its fine again:wp media regenerate --skip-delete --only-missing
Describe how other contributors can replicate this bug
medium
in WordPress--image_size=medium
_wp_attachment_metadata
Describe what you would expect as the correct outcome
I would expect, that all other sizes would still be in the metadata, only the specific size changed
Let us know what environment you are running this on
The text was updated successfully, but these errors were encountered: