A
A
Alexander Petrov2016-03-29 17:47:49
Ruby on Rails
Alexander Petrov, 2016-03-29 17:47:49

How to crop photos in paperclip?

Let's say I set it up like this:
has_attached_file :image, styles: { preview: "250x150>"}
If I upload an image sized 200 by 600. Then 600 pixels turn into 150, and 200 proportionally into some more.
But how can I make the size change so that the picture will occupy all 250 by 150 and some part will be cut off?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2016-03-29
@Mirkom63

has_attached_file :image, styles: { preview: "250x150#"}

I think it used to be

A
ArtemBlueberry, 2016-03-29
@ArtemBlueberry

has_attached_file :image, styles: { thumb: "100x100"},
convert_options: {preview: "-gravity north -thumbnail 250x150^ -extent 250x150"}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question