Open james58899 opened 1 year ago
@james58899 When you ran into this bug, did you have the checkbox to generate both WebP and JPEG (under Settings > Media
) enabled or disabled?
@james58899 When you ran into this bug, did you have the checkbox to generate both WebP and JPEG (under
Settings > Media
) enabled or disabled?
I didn't enable it, only generate thumbnails in webp format.
@james58899 thanks for reporting the issue.
I replicate the issue when I regenerate the image using the plugin. The above PR resolves the issue with the full-size image. I find one more bug when I regenerate images multiple times.
Images after the first regeneration:
Images after the second regeneration:
@mukeshpanchal27 Actual issue is with replacing original image with custom mime type version here in this line: https://github.com/WordPress/performance/blob/trunk/modules/images/webp-uploads/load.php#L136
So it creates 2 issues there.
Adding @adamsilverstein I added this to Images and the Needs Triage label. Please advise on next steps.
If using the Regenerate Thumbnails plugin regenerate thumbnail cause file duplication.
@james58899 - I assume you are using this plugin. With this plugin, unless you enable the "Delete thumbnail files" option, the old files are left in place when doing a regenerate command. Unless this box is checked WordPress creates new files and will generate new filenames as needed.
Closing this as "works for me" because this looks like the expected behavior to me. If I have missed something, please feel free to re-open this issue.
@adamsilverstein The issue is image-jpg.webp
file regenerates as image-jpg-webp.webp
and the original image replace as image-jpg.webp
, which doesn't look like the expected behavior.
Regenerating the thumbnail should not change the information of the original image, nor should it infinitely generate new webp files.
Regenerating the thumbnail should not change the information of the original image, nor should it infinitely generate new webp files.
I will give this a test. The file naming probably isn't a concern as long as the file meta is right.
@james58899 I am still unable to reproduce the issue, have you tested with the latest version of the plugin? is your original upload a jpeg? do you have a.custom filter applied to generate both jpeg and webp?
@adamsilverstein Yes, the issue still exists, please reopen the issue. According to the above comment, this issue is obviously reproducible, and there is a PR related to this issue, how did you try to reproduce this issue?
Everything works fine when the image is just uploaded.
After the thumbnail is regenerated for the first time, the original image is replaced with webp, and a new webp file is generated.
After the thumbnails are regenerated a second time, the original images are replaced again, and a bunch of new webp thumbnails are generated.
A lot of files are left in the folder without being deleted.
Same as first time.
All files have been deleted.
@james58899
I can confirm your findings.
Initially, I couldn't reproduce issue, until I disabled [_] Generate JPEG files in addition to WebP
, like you did here.
@adamsilverstein
@adamsilverstein I'm going to reopen the issue as i still replicate the issue.
Install and activate the Performance Lab plugin with default settings (Enable WebP Uploads)
Install Regenerate Thumbnails plugin
Upload the image. ex. car.jpeg
.
Go to Media > Edit image then click on Regenerate Thumbnails
button.
Again click on Regenerate Thumbnails
button.
Excellent, thank you @mukeshpanchal27 and @james58899 for the detailed steps to reproduce. I will retest and see what the best solution is. It looks like in an attempt to avoid name collisions we are inadvertently creating extra names.
I'm curious (and will test) - if you delete the original image, are you left with stray images that aren't deletes?
Bug Description
If using the Regenerate Thumbnails plugin regenerate thumbnail cause file duplication.
Steps to reproduce
Screenshots
Before regenerate:![](https://user-images.githubusercontent.com/5798637/200253395-902b4814-6316-4e7e-9158-4f75367b3ee4.png)
After regenerate:![](https://user-images.githubusercontent.com/5798637/200253523-5f78656d-1886-4e04-9c68-23a0a9d52402.png)
Additional Context