Shr*_*yas 3 resize ruby-on-rails paperclip
即使我附加了大图像,图像肯定会调整大小但不会达到指定的尺寸.例如,像这样调整'791 X 1015'图像的大小
指定 - 调整大小
400 X 250 - 195 X 250
89 X 50 - 39 X 50
这是我的代码:
has_attached_file :data, :styles => { :medium => "400x250>", :small => "150x150>", :thumb => "80x50>" }
Run Code Online (Sandbox Code Playgroud)
我正在使用
Paperclip 2.3.8
Ruby 1.8.7
Rails 2.3.2
Ubuntu 10.04
有任何想法吗 ?谢谢!
ImageMagick保持图像宽高比
widthxheight> Change as per widthxheight but only if an image dimension exceeds a specified dimension
因此,对于791 x 1015像素的图像,它将调整为尺寸为195 x 250的图像.如果您希望它适合400 x 250忽略纵横比,则必须使用 widthxheight!
更多信息:http:
//www.imagemagick.org/script/command-line-processing.php#geometry
| 归档时间: |
|
| 查看次数: |
1707 次 |
| 最近记录: |