检查图像是否为纵向或横向?

时间:2014-06-14 10:41:12

标签: ruby-on-rails image-processing minimagick

我有一个裁剪图像系统,我只想发送肖像图像。 问题是我不知道如何在将图像发送到一个或另一个地方之前验证图像是肖像还是风景。

我想过Mini Magick,也许是这样的? (不会工作)

照片模型

  def validate_image_size
    image = MiniMagick::Image.open(photo.path)
     if image[:height] > image[:width]
      #send the image to this place
    end
  end

1 个答案:

答案 0 :(得分:1)

好的验证员现在正在工作。

  def validate_image_size
    image = MiniMagick::Image.open(photo.path)
     if image[:height] > image[:width]
      #send the image to this place
    end
  end
相关问题