andrefarzat / ng-jcrop

Angular directive to jCrop jQuery plugin
GNU General Public License v2.0
101 stars 39 forks source link

Not working with Cloudinary #46

Closed benjamincanac closed 7 years ago

benjamincanac commented 8 years ago

I tried to use this plugin with the Cloudinary API using the crop mode, but the result is never good.

http://cloudinary.com/documentation/node_image_manipulation#crop_mode

Have you ever experienced this issue ?

Thanks.

andrefarzat commented 8 years ago

@benjamincanac never tried with cloudinary. It might be that jCrop sends an array and cloudinary expects an object with the data to be cropped ? ( I am guessing here, haven't read all the docs )

benjamincanac commented 8 years ago

@andrefarzat Cloudinary expects 4 parameters : x / y / width / height. I'm sending the good object using the values in the jCrop array.

I'm sure this is good because it works approximately, with small images it works almost perfectly but bigger the image is, the more the image is shifted.

andrefarzat commented 8 years ago

This was the last changed we did here: https://github.com/andrefarzat/ng-jcrop/pull/34 trying to guess again: it can be something related to min/max width and it sends the wrong ratio or wrong width/height ? ( I really dunno what can be happening )

benjamincanac commented 8 years ago

Yes but in my case, the image is bigger than the min/max width.

I also think that the ratio calculated is wrong and it affects all the values because you multiply every value with the ratio.

However, I've quickly looked into your code and for me your ratio algorithm is ok, so I've no idea either.