2010-07-15 69 views
4

是什麼#兩者的區別>或裁剪拇指時:的Rails:回形針裁剪語法

例如:

has_attached_file :image, :styles => {:small => "100x100#"} 


has_attached_file :image, :styles => {:small => "100x100>"} 

如何獲取擁有100像素,但變量的最大信號高度拇指寬度(以保持寬高比)?

感謝

德布

回答

10

回形針使用ImageMagick的被窩裏,這裏是充分ImageMagick的幾何設置的鏈接(你會在你的推杆:小縮略圖定義):

http://www.imagemagick.org/script/command-line-processing.php#geometry

聽起來像是你想要的:「給定的高度,自動選擇寬度以保持寬高比。」

has_attached_file :image, :styles => {:small => "x100"} 
+0

的感謝!我會試試看! – deb 2010-07-15 18:29:22

+0

完美無缺!再次感謝 – deb 2010-07-15 20:34:09

+0

imagemagick鏈接沒有解決「#」的含義,因此問題仍未解決。 – 2017-04-29 00:26:32

-1
has_attached_file :photo, 
    :styles => { 
    :thumb=> "100x100#", 
    :large => "400x400>" }