回形针是否可能:只刷新特定类型的拇指?

时间:2011-07-19 15:36:25

标签: ruby-on-rails paperclip

我的照片模型有几个不同的版本,我只更新了tiny_thumb。我可以刷新一种类型而不是所有其他类型吗?

我模特的剪辑:

class Photo < ActiveRecord::Base
  has_attached_file :photo, 
      :styles => { :cropped_thumb => {:geometry => "115x70#", :jcrop => true}, :resized_thumb => {:geometry => "115x70>"}, :deal => {:geometry => "64x56#"},  
      :cropped_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}#", :jcrop => true},
      :resized_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}>"},
      :tiny_thumb => {:geometry => '120x120>'},

我试过了..

rake paperclip:refresh:tiny_thumb class=Photo

但我认为这是一个糟糕的猜测,并没有奏效。

1 个答案:

答案 0 :(得分:2)

我没有尝试,但您可以在ruby脚本中执行此操作:

Photo.all.each{ |instance| instance.photo.reprocess!(:tiny_thumb) }