[ 
https://issues.apache.org/jira/browse/CB-2896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627846#comment-13627846
 ] 

Sébastien BUREL commented on CB-2896:
-------------------------------------

Yes i try to retreive the exif part on my server, i have also try with open 
source tools ans got the same problems.
In fact i have isolated the bug, when you call createExifIFDFromDict for the 
second time (subExifIFD), the offset you calculate doesn't take in account that 
second position. Then the data with a length > 8 are append with a wrong 
offset. It concern DateTimeDigitized and DateTimeOriginal.
I didn't tried to find a fix because i found the 
CGImageDestinationAddImageFromSource solution.

For my application, i also need GeoTagging and Metadata for image coming from 
SaveAlbum and Photo library.
Using the same trick, i am abble to make jpeg with metadat including geotagging 
from assetsLibrary:

NSDictionary *metadata = [info 
objectForKey:@"UIImagePickerControllerMediaMetadata"];
if (metadata) {
                CGImageSourceRef sourceImage = 
CGImageSourceCreateWithData((__bridge_retained CFDataRef)data, NULL);
                CFStringRef sourceType = CGImageSourceGetType(sourceImage);
                
                CGImageDestinationRef destinationImage = 
CGImageDestinationCreateWithData((__bridge CFMutableDataRef)data, sourceType, 
1, NULL);
                CGImageDestinationAddImageFromSource(destinationImage, 
sourceImage, 0, (__bridge CFDictionaryRef)metadata);
                CGImageDestinationFinalize(destinationImage);
                
                CFRelease(sourceImage);
                CFRelease(destinationImage);
}
else {
                NSURL *url = [info 
objectForKey:UIImagePickerControllerReferenceURL];
                if (url) {
                                self.data = data;
                                
                                void 
(^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *) = ^(ALAsset *asset) {
                                         CDVPluginResult* result = nil;
                                         NSDictionary *metadata = 
asset.defaultRepresentation.metadata;

                                                CGImageSourceRef sourceImage = 
CGImageSourceCreateWithData((__bridge_retained CFDataRef)self.data, NULL);
                                                CFStringRef sourceType = 
CGImageSourceGetType(sourceImage);
                                                
                                                CGImageDestinationRef 
destinationImage = CGImageDestinationCreateWithData((__bridge 
CFMutableDataRef)self.data, sourceType, 1, NULL);
                                                
CGImageDestinationAddImageFromSource(destinationImage, sourceImage, 0, 
(__bridge CFDictionaryRef)metadata);
                                                
CGImageDestinationFinalize(destinationImage);
                                                
                                                CFRelease(sourceImage);
                                                CFRelease(destinationImage);
.....
                                };
                                ALAssetsLibrary *library = [[ALAssetsLibrary 
alloc] init];
                                [library assetForURL:url 
resultBlock:ALAssetsLibraryAssetForURLResultBlock failureBlock:^(NSError 
*error) {}];
                                self.hasPendingOperation = YES;
                                return;
                }
}
/* splice loc */
//CDVJpegHeaderWriter* exifWriter = [[CDVJpegHeaderWriter alloc] init];
//NSString* headerstring = [exifWriter createExifAPP1:[info 
objectForKey:@"UIImagePickerControllerMediaMetadata"]];
//[exifWriter spliceExifBlockIntoJpeg:data withExifBlock:headerstring];
}




                
> Multipart exif tags are not written correctly
> ---------------------------------------------
>
>                 Key: CB-2896
>                 URL: https://issues.apache.org/jira/browse/CB-2896
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.6.0
>            Reporter: Lorin Beer
>            Assignee: Lorin Beer
>            Priority: Critical
>             Fix For: 2.6.0
>
>
> multi-part (complex) tags are not written correctly. this leads to an exif 
> string which is of the correct size (and therefore is not reported as an 
> error) but cannot be read back out.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to