hyperrjas
hyperrjas

Reputation: 10744

scale image only width with minimagick in ruby on rails 3

I am using this method for resize the images:

version :big do
            process :resize_to_fit => [560, 200]
            process :convert => :png
          end

But with this method I have that write a height fixed.

I want only scale or resize the width image.

I want the height of the image is automatic and scale the image to the width that has been given.

How can I scale or resize, only the width image?

I'm using minimagick with carrierwave.

Upvotes: 2

Views: 2527

Answers (1)

MrTheWalrus
MrTheWalrus

Reputation: 9700

It's actually quite easy to do this. Here's an example:

  version :column do
    process :resize_to_fit => [250, nil]
  end

This version will be rescaled so that the width is the specified value (250, in my case), and will retain the aspect ratio.

Upvotes: 8

Related Questions