Search code examples
ruby-on-rails-4jcropcloudinary

Rails / Attachinary / Jcrop - save only the cropped image


I am working on a Rails project that involves images, for which I use Cloudinary with Attachinary.

It is a very standard situation, where a user selects a picture, can preview it (I am using jQuery fileupload as well), crop it (using Jcrop), and then save it. I would like to only save the cropped image on Cloudinary, not the coordinates for cropping on display.

I have found multiples things about that, even very close like Using jCrop with cloudinary through rails 4 to crop before creating image or http://cloudinary.com/documentation/rails_carrierwave, but every time the solution involves some php or CarrierWave, whereas I am using Attachinary.

I have no code to show, as I just don't know how to start and what to use, so some guidelines would be much appreciated. Thank a lot !


Solution

  • You can either resize the image via Jcrop and upload the cropped image to Cloudinary, or have the coordinates returned by Jcrop and pass them to Cloudinary to crop the image as an incoming transformation.