, as :medium => \"480x320>\". I am not exactly" />
开发者

Difference between # and > in paperclip styles for image

开发者 https://www.devze.com 2023-03-27 19:05 出处:网络
I have s开发者_JS百科een that in using :styles attributes in Paperclip, you ca specify sizes with #, as :thumb => \"100x100#\" as well as with >, as :medium => \"480x320>\". I am not exactly

I have s开发者_JS百科een that in using :styles attributes in Paperclip, you ca specify sizes with #, as :thumb => "100x100#" as well as with >, as :medium => "480x320>". I am not exactly sure about the difference between the usage of # and >. Can anyone please enlighten me? Thanks.


These follow the rules of formatting for ImageMagick which can be found here The > lets the image keep the same aspect ratio when it is being scaled so it doesn't get distorted.

You will not find the # key in the ImageMagick docs though, that is special to paperclip. It allows simple cropping of thumbnails to the specified size. See here for a good explanation [via Wayback Machine], about halfway down the page.


The string you are referring to is passed to ImageMagick as a geometry string. You can read more about the possible values here: http://www.imagemagick.org/Magick++/Geometry.html

0

精彩评论

暂无评论...
验证码 换一张
取 消