이미지가 버전 크기보다 큰 경우에만 carrierwave에서 버전을 생성 할 수 있습니다 (예 : 엄지).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
새로운 구문 : 'img.resize_to_fit! (width, img.rows) if img.columns> = width' – scarver2