Images not created after wp media regenerate
-
Just to let you know that the images are not created/updated when running
wp media regenerate
from the CLI.
-
Hi @jamieburchell,
Thank you for your message.
I would like more information about this so I can investigate. Tell me what exactly happens when you enter this command and how you checked that the images were not converted.
Best,
MateuszSure, no problem. Running
wp media regenerate --yes
causes WordPress to regenerate all of the thumbnails (and remove old ones). I ran this command after changing the “Medium” size dimensions in the Media settings in WordPress. After the command completed I noticed that the newly created files were missing from theuploads-webpc/uploads/...
directory.I also tested removing all of the files and directories under
uploads-webpc
and runningwp media regenerate --yes
again, and noticed that theuploads-webpc
remained empty after the command had completed.It’s not a big deal really, since I just started the bulk optimization again from within your plugin but I wondered if it was intentional.
@jamieburchell First of all, our plugin does not support the
--yes
flag. The following command converts all images:
wp converter-for-media regenerate
If you have converted these images and run the process again, the images will not be converted again. To make this happen, you should use an additional flag:
wp converter-for-media regenerate --force
I think we are talking at cross purposes. I’m reporting that your plugin does not update/regenerate the images it has after running WordPress’s built-in WP CLI command
wp media regenerate --yes
. I’m not talking about thewp converter-for-media
command.@jamieburchell Yes, you’re right – sorry. Thank you for explaining this to me.
I tested it on my WordPress installation – I had one image converted to WebP there. Then I used the following command:
wp media regenerate --yes
Then all thumbnails were restored (please pay attention to the date of file modification):
https://i.snipboard.io/4gZ0ju.jpgI then checked the /uploads-webpc directory and the corresponding WebP files there were also converted to WebP again (please pay attention to the date of file modification):
https://i.snipboard.io/V4Kcz2.jpgIn my opinion everything works fine.
If I remove all the directories under
uploads-webpc/uploads/
then runwp media regenerate --yes
the directories and webp files are not recreated.Similarly, if I edit the default thumbnail sizes and have WordPress regenerate the images, the webp versions of the new sizes are not created either.
I have some SVGs in my uploads folders and so the
wp media regenerate
command understandably “fails” at the end:Error: Only regenerated 7 of 13 images (6 failed).
- This reply was modified 1 year ago by jamieburchell.
@jamieburchell Here’s what my directories look like before starting the test:
I run the following command (I use the default settings of the Converter for Media plugin.):
wp media regenerate --yes
And now my directories look like this:
In my opinion everything works fine. When you regenerate thumbnails, WebP files are automatically generated for these thumbnails. What do you think isn’t working properly?
Error: Only regenerated 7 of 13 images (6 failed).
What do you think this error has to do with my plugin? You use a command built into WordPress, not a command dedicated to my plugin.
@mateuszgbiorczyk OK, the webp images aren’t appearing for me when I run
wp media regenerate --yes
.I only mentioned the error (could not process SVG files) in case that would impact on your plugin being able to generate the webp files and explain why it doesn’t work for me.
@jamieburchell I don’t know the reason why these files are not generating for you. I tested it in my environment and everything works fine. It’s hard for me to say anything more when I can’t replicate the problem myself. I hope that you understand me.
I understand. I’ll see if I can figure out why it’s not working.
Also noticed something strange when I manually ran
wp converter-for-media generate
the stats seem incorrect.Bulk Optimisation 100% [===============================================================================================] 0:11 / 0:09
Success: The process was completed successfully. Your images have been converted!
Saving the weight of your images: 204.02 MB
Successfully converted files: 149My uploads folder contains 66 files (some are non-images), totalling 91MB. After the webp conversion, I have 53 webp files totalling 4.7MB. Not sure where 204.02MB and 149 files comes from.
@jamieburchell Please delete the /uploads-webpc directory again and go to the plugin settings. In the Bulk Optimization of Images section you can see all the images that will be optimized. Please send me a screenshot of this section after expanding the directory list.
https://snipboard.io/nfZBgL.jpg
49 images can be converted.
After running regenerate from the CLI:
Success: The process was completed successfully. Your images have been converted!
Saving the weight of your images: 204.02 MB
Successfully converted files: 149
Failed or skipped file conversion attempts: 0View then from the UI
@jamieburchell When you run the command below, what is the effect (when the /uploads-webpc directory is empty)?
wp converter-for-media calculate
I think you’re doubling up on your calculations.
I printed out the
$response
array from WpCliManager line 164:10 + 20 + 30 + 40 + 49 = 149
??
Array ( [is_fatal_error] => [errors] => Array ( ) [files] => Array ( [webp_available] => 10 [webp_converted] => 10 [avif_available] => 0 [avif_converted] => 0 ) [size] => Array ( [before] => 15299736 [after] => 828164 ) ) Array ( [is_fatal_error] => [errors] => Array ( ) [files] => Array ( [webp_available] => 20 [webp_converted] => 20 [avif_available] => 0 [avif_converted] => 0 ) [size] => Array ( [before] => 27131098 [after] => 1612828 ) ) Array ( [is_fatal_error] => [errors] => Array ( ) [files] => Array ( [webp_available] => 30 [webp_converted] => 30 [avif_available] => 0 [avif_converted] => 0 ) [size] => Array ( [before] => 45932811 [after] => 2807296 ) ) Array ( [is_fatal_error] => [errors] => Array ( ) [files] => Array ( [webp_available] => 40 [webp_converted] => 40 [avif_available] => 0 [avif_converted] => 0 ) [size] => Array ( [before] => 62960416 [after] => 3846938 ) ) Array ( [is_fatal_error] => [errors] => Array ( ) [files] => Array ( [webp_available] => 49 [webp_converted] => 49 [avif_available] => 0 [avif_converted] => 0 ) [size] => Array ( [before] => 76465124 [after] => 4760344 ) )
@jamieburchell When you run the command below, what is the effect (when the /uploads-webpc directory is empty)?
wp converter-for-media calculate
The correct figures:
How many images to convert are remaining on my website?
Success: 49 for AVIF and 49 for WebP
- The topic ‘Images not created after wp media regenerate’ is closed to new replies.