如何调整大小和居中图像

时间:2011-12-03 08:32:29

标签: ruby-on-rails imagemagick paperclip

我想将方形图像设置为正方形并用于此方形图像中心。如何用回形针完成它?

1 个答案:

答案 0 :(得分:1)

这将拍摄一张图像,以500x500的比例在图像中心裁剪,然后扔掉所有其他内容,然后将该新图像调整为100x100。它用于生成方形缩略图,但您可以根据需要进行调整。

has_attached_file :image,  
  :styles => { :thumb => "" },
  :convert_options => { 
    :thumb => "-gravity Center -crop 500x500+0+0 +repage -resize 100x100^", 
  :default_style => :thumb
相关问题