cordova-plugin-k-imagecropper icon indicating copy to clipboard operation
cordova-plugin-k-imagecropper copied to clipboard

In iOS, cropping new image returned old image path which showed incorrect image. [Proposed Solution Inside]

Open necixy opened this issue 6 years ago • 1 comments

necixy avatar Nov 12 '18 07:11 necixy

Original library was great in every manner. In iOS, there was a small bug that cropping new image returned old image path which showed incorrect image. To make file name unique and avoid name mismatch, adding intervalString as an extra layer in the file name for iOS and it solved problem (at least for me).

Following code is added in KImageCropper.m file, inside tempFilePath function:

NSTimeInterval  today = [[NSDate date] timeIntervalSince1970];
NSString *intervalString = [NSString stringWithFormat:@"%f", today];
filePath = [NSString stringWithFormat:@"%@/%@%03d_%@.%@", docsPath, CDV_PHOTO_PREFIX, i++, intervalString , extension];

Made a little forked version to address above issue and that can be found here: https://github.com/necixy/cordova-plugin-k-imagecropper

Feel free to use forked version this if you're facing the same bug in the original library.

necixy avatar Nov 12 '18 07:11 necixy