mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
ImagePicker returning same image (#306)
ImagePicker returning same image Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com> Co-authored-by: Tim Brust <github@timbrust.de>
This commit is contained in:
parent
db4b4b947d
commit
a9436b1a18
@ -398,11 +398,12 @@ static NSString* toBase64(NSData* data) {
|
|||||||
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
||||||
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
|
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
|
||||||
NSString* filePath;
|
NSString* filePath;
|
||||||
|
|
||||||
// generate unique file name
|
// unique file name
|
||||||
int i = 1;
|
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
||||||
|
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
|
||||||
do {
|
do {
|
||||||
filePath = [NSString stringWithFormat:@"%@/%@%03d.%@", docsPath, CDV_PHOTO_PREFIX, i++, extension];
|
filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
|
||||||
} while ([fileMgr fileExistsAtPath:filePath]);
|
} while ([fileMgr fileExistsAtPath:filePath]);
|
||||||
|
|
||||||
return filePath;
|
return filePath;
|
||||||
|
Loading…
Reference in New Issue
Block a user