carrierwaveuploader / carrierwave

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
https://github.com/carrierwaveuploader/carrierwave
8.78k stars 1.66k forks source link

Carrierwave doesn't deal with aspect ratios? #2715

Closed tsipa88 closed 10 months ago

tsipa88 commented 11 months ago

I'm dancing with image resizer and have a list of required image dimensions (100x200, 300x120 ... etc). This list also includes aspect ratios (3:4, 16:9, 1:1).

How I can use carrierwave with aspect ratios? The dimensions in this case should not be taken into attention at all - images can be of completely different sizes in pixels. For example process resize_to_fill: [16:9]

Search didn't help me ... (

Thanks!

tsipa88 commented 11 months ago

Ok, I get it

version :cropped do
  process :crop
end

def crop
  manipulate! do |image|
    image.combine_options do |c|
      c.extent '3:2'
    end
  end
end

works great.