If you use file_column for some projects and find that you want to change the thumbnail sizes that you’ve been using for models, then hopefully this little bit of code can help.
Add this as a rake task and run it as
rake "filecolumn:regenerate[Model, field]" RAILS_ENV=production where Model is the model you want to regenerate images for and field is the filecolumn field on the model. The task uses Rake arguments, so you’ll need Rake 0.8.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The code essentially boils down to 2 lines…
- setting @just_uploaded to true on the state object
- calling the transform_with_magick method on the state object