How to set width only for loaded clip image?

I am loading a large image into my model using Paperclip. I would like to set only the width of the image and let it automatically resize the height.

has_attached_file :picture, :styles => { :large => "900", :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png" 

In sizes :medium and :thumb I set both height and width. Q :large I just want to set the width and let it be as high as it should be.

Any suggestions?

+6
source share
2 answers

Try using :large => "900x" . This should change the width to the desired value and keep the original aspect ratio.

+11
source

Width Only :large => "900"

Height Only :large => "x900"

Additional commands: http://www.imagemagick.org/script/command-line-processing.php#geometry

+2
source

Source: https://habr.com/ru/post/948961/


All Articles