开发者

How do you reprocess different versions of an image in Carriewave?

I created 3 versions of my Avatar:

process :resize_to_limit => [400, 400]  

   version :big_thumb do
     process :resize_to_limit => [80, 80]
   end

   version :small_thumb do
     process :resize_to_limit => [50, 50]
   end

I wrote a crop function to crop my original version, which works, but I can't seem to regenerate my 2 thumbnails based off of that newly c开发者_如何学编程ropped original version.

Any ideas?


Sorry if this is not what you're looking for but, I took this from the carrierwave docs

Recreating versions

You might come to a situation where you want to retroactively change a version or add a new one. You can use the recreate_versions! method to recreate the versions from the base file. This uses a naive approach which will re-upload and process all versions.

instance = MyUploader.new
instance.recreate_versions!

Or on a mounted uploader:

User.all.each do |user|
  user.avatar.recreate_versions!
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜