Joseph Le Brech
Joseph Le Brech

Reputation: 6653

Reprocessing images in Carrierwave

Let's say my model has an image with :thumb and the client wants :tiny and :nano thumbnails.

How do I reprocess all the existing images using a rake task?

I've found a rake task that I thought would do it https://gist.github.com/777788 but it's giving me errors.

Upvotes: 31

Views: 9221

Answers (2)

MZaragoza
MZaragoza

Reputation: 10111

I wanted to expand on this great answer by Mikhail Nikalyukin

To Reprocess a single version you can do something like this

Model.all.each do |model|
  model.image.recreate_versions!(:version1, :version2)
end

this way if you added a new version you dont have to do all of them again

Upvotes: 2

Mikhail Nikalyukin
Mikhail Nikalyukin

Reputation: 11967

According to the Carrerwave documentation you can use following commands:

Model.all.each do |model|
  model.image.recreate_versions!
end

Upvotes: 57

Related Questions