vendredi 10 avril 2015

How to crop image in Rails / Paperclip / Carrierwave

There is the following model code:



class StoreItem < ActiveRecord::Base

has_attached_file :image
validates_attachment :image, content_type: { content_type: /\Aimage\/.*\Z/ }
end


There is the following task I need to do - for example, user upload 100x800 PNG image. At first I must crop image to get some square image, then to compress for '300x300' image. How can I do it using Paperclip/Carrierwave/Imagemagick? Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire