Simple cropping with Paperclip

北战南征 提交于 2019-11-27 09:50:49

问题


I would like to crop images on upload using Paperclip to get square thumbs from the center of the original picture. I find out a method in documentation that seems to do exactly what I want:

transformation_to(dst, crop = false)

The problem is that I can't figure out where to use this method. It would be great to simply pass something as a parameter here:

  has_attached_file :picture, 
                    :styles => { :medium => "600x600>", :thumb => "something here" }

回答1:


You only need to use # instead of > as a parameter:

has_attached_file :picture, :styles => { :thumb => "200x200#" }


来源:https://stackoverflow.com/questions/1017509/simple-cropping-with-paperclip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!