rookieRailer rookieRailer - 4 months ago 13
Ruby Question

Difference between # and > in paperclip styles for image

I have seen 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.

Answer

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, about halfway down the page.

Comments