【发布时间】:2012-09-12 15:18:55
【问题描述】:
只有当图像大于版本的大小时,才可以使用carrierwave 创建一个版本(例如拇指)??
例子:
version :thumb, :if => :is_thumbnable? do
process :resize_to_fit => [32,nil]
end
protected
def is_thumbnable?(file)
image ||= MiniMagick::Image.open(file.path)
if image.nil?
if image['width'] >= 32 || image['height'] >= 32
true
else
false
end
else
false
end
end
【问题讨论】:
标签: ruby-on-rails-3 carrierwave minimagick