Using Carrierwave, I created 3 versions of an avatar - an original, a small_thumb and a large_thumb using the following lines:
process :resize_to_limit => [40
This HowTo was most helpful for me (even if I don't use fog):
https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Recreate-and-reprocess-your-files-stored-on-fog
I added a reprocess method on my model and then called it in for each loop in my rake task:
def reprocess
begin
self.process_photo_upload = true
self.photo.cache_stored_file!
self.photo.retrieve_from_cache!(photo.cache_name)
self.photo.recreate_versions!
self.save!
rescue => e
STDERR.puts "ERROR: MyModel: #{id} -> #{e.to_s}"
end
end
Rake:
task :reprocess_photos => :environment do
MyModel.all.each{|mm| mm.reprocess}
end
PS: Rails 4.2