jeduan / cordova-plugin-crop

Crop an image in Cordova
MIT License
114 stars 170 forks source link

adds support for targetWidth and targetHeight options #46

Closed epetre closed 6 years ago

epetre commented 7 years ago

It is also related to https://github.com/jeduan/cordova-plugin-crop/issues/2

jerwarren commented 7 years ago

This works great on Android if you specify a square image, but if your targetWidth and targetHeight don't match, you get a freeform crop box :(

jerwarren commented 7 years ago

I took a quick peek, and it turns out the Android cropper has this:

public Crop withAspect(int x, int y) { cropIntent.putExtra(Extra.ASPECT_X, x); cropIntent.putExtra(Extra.ASPECT_Y, y); return this; }

Calling that with the specific width and height does lock it to that aspect. It doesn't restrict the size, but I think the aspect is the important bit...

hannut91 commented 7 years ago

if targetWidth has -1 value, targetWidth value is image NSUInteger type is unsigned integer So I changed to NSInteger like this

@property (assign) NSInteger targetWidth; @property (assign) NSInteger targetHeight;

Thank you

epetre commented 7 years ago

@jerwarren & @hannut91 nice, yes true.

Just not sure if this project here is still alive.