キャリアウェーブの現在のインスタンスの幅と高さを知る必要があります
例えば:
image_tag image.photo_url,:width => image.photo.width, :height => image.photo.height
しかし、問題は、image.photo.widthとimage.photo.heightが機能していないことです。
何か案は ?
キャリアウェーブの現在のインスタンスの幅と高さを知る必要があります
例えば:
image_tag image.photo_url,:width => image.photo.width, :height => image.photo.height
しかし、問題は、image.photo.widthとimage.photo.heightが機能していないことです。
何か案は ?
ImageMagick、RMagick、またはMiniMagickをインストールする必要があります。次に、ファイル(画像)を開いてから、その高さを確認します。
例:https ://github.com/jnicklas/carrierwave#conditional-versions (is_landscape?メソッドを参照)、ここにコピー:
def is_landscape? picture
image = MiniMagick::Image.open(picture.path)
image[:width] > image[:height]
end
またはこの他の関連する質問: