How can I manually regenerate optimized images?

AI-generated summary

The discussion revolves around manually regenerating optimized images in Discourse after a hardware issue caused some image assets to be lost. Initially, bartv tried rebuilding HTML posts, but it didn’t work for all images. After rebuilding all posts from the last two days bartv and discovering that his CDN was still serving old content, bartv asked how to force a regeneration of the optimized images for recent posts. gerhard suggested running rake uploads:regenerate_missing_optimized, which bartv confirmed was not listed in rake --tasks. tshenry explained that tasks without descriptions are not included in rake --tasks, but can be listed with rake -AT. Ultimately, bartv successfully regenerated the optimized images using the suggested rake task.

Hi,

After some hardware issues last night we lost some optimized image assets. As this only seems to affect a very small number of posts, I’d like to manually regenerate them. For some, the ‘Rebuild HTML’ tool fixes it, but for others it doesn’t. Is there a rake task for this + can I run it on individual topics/posts?

Update: I rebuilt all posts of the last two days, but some still have a missing optimised thumbnail image. I checked and the original images are still available on disk. It’s just the rebuild that’s not working for some reason. Any ideas how I can force Discourse to regenerate those images? Here’s an example of an affected topic.

Update 2: It seems that my original assumption that ‘it worked for some images’ was incorrect - I believe that my CDN is still having some of the old content. So to rephrase my question: how do I do a ‘rebuild’ of recent posts and force a regeneration of the optimized images for these posts?

Try rake uploads:regenerate_missing_optimized

Great, I’m going to try that. FYI, it seems this task is not included when you run rake --tasks (I checked before asking last weekend).

rake --tasks will only list the tasks that have a description. To list everything, you can run
rake -AT

That fixed it, thanks!