2014-01-12 78 views
0

看起來像這應該是一個簡單的問題,但在http://www.imagemagick.org/script/command-line-processing.php?ImageMagick=lj6pre8q2iautc3ch6nuph1fc2#geometry使用文檔後無法使它工作。獲取指定的寬度和高度rmagick和回形針

所有我想要得到的是讓我的圖像有一個設置的寬度和設置高度在450px寬和300px高度,並保持其縱橫比。哪種風格可以做到這一點?

+1

這是否回答你的問題? http://stackoverflow.com/questions/2728655/paperclip-resize-to-fit-a-rectangular-box – Bartosz

回答

1

這應該有助於

has_attached_file :image, 
       :styles => { 
        :thumb => "125x100#", 
        :small => "450x300>", 
        :large => "600x600>" 
       }, 
       :url => "/path/to/:id/:style/:basename.:extension", 
       :path => ":rails_root/path/to/:id/:style/:basename.:extension"