cordova-plugin-k-imagecropper
cordova-plugin-k-imagecropper copied to clipboard
In iOS, cropping new image returned old image path which showed incorrect image. [Proposed Solution Inside]
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.