Reputation: 2019
I have a rails 3 application which uses the CarrierWave gem. Until now, I have uploaded my pictures in 48*48 and 100*100 but now I would like to store them in 200*200.
Is there a way to resize my already uploaded images ?
Upvotes: 5
Views: 2415
Reputation: 810
If you want to crop/resize every pictures:
MyModel.where.not(picture: nil).each{|v| v.picture.resize_to_fill(150, 150)}
/!\ It will replace the original picture.
Upvotes: 0
Reputation: 5206
Yes, you have to add you new version to the image uploader...
version :thumb do
process :resize_to_fill => [200,200]
end
...and then recreate them:
User.all.each do |user|
user.avatar.recreate_versions!
end
See carrierwave's readme.
Upvotes: 11