# Generating missing optimized images with S3

**URL:** https://meta.discourse.org/t/generating-missing-optimized-images-with-s3/35847
**Category:** Support
**Created:** [November 20, 2015, 5:24pm UTC](https://meta.discourse.org/t/generating-missing-optimized-images-with-s3/35847 "2015-11-20T17:24:35Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [August 27, 2018, 6:16pm UTC](https://meta.discourse.org/t/generating-missing-optimized-images-with-s3/35847/6 "2018-08-27T18:16:15Z")

</div>

I’m not sure if the following is complete, but this rails console command removes all optimized images then regenerates the ones used for avatars:

```ruby
OptimizedImage.destroy_all
UserAvatar.all.each {|ua| uaid = ua.gravatar_upload_id || ua.custom_upload_id; Jobs::CreateAvatarThumbnails.perform_async(upload_id: uaid) if uaid }

```

---

_[View the full topic](https://meta.discourse.org/t/generating-missing-optimized-images-with-s3/35847)._
