How can I manually regenerate optimized images?

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?

3 Likes

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.

1 Like

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

8 Likes

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

9 Likes

That fixed it, thanks!

3 Likes