You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/11/03 06:42:52 UTC

[GitHub] [cordova-plugin-camera] ryaa commented on issue #501: Fixed corrupted image on ios 13 when using camera

ryaa commented on issue #501: Fixed corrupted image on ios 13 when using camera
URL: https://github.com/apache/cordova-plugin-camera/pull/501#issuecomment-549109960
 
 
   I have been experience the same problem on iOS 13.2 and the problem seems to be that when we copy the image with metadata (exif data) from the source to destination in imagePickerControllerReturnImageResult method of CDVCamera.m the resulting file is of 0 size and CGImageDestinationFinalize returns false (fails!). If I disable geolocation for camera by setting the below in config.xml and everything works well.
   ```
   <preference name="CameraUsesGeolocation" value="false" />
   ```
   
   I tried two fixes and both seems to be working:
   1) I changed imagePickerControllerReturnImageResult in CDVCamera.m based on this suggestion https://github.com/vlinde/cordova-plugin-camera-with-exif/commit/99465b4c078bac48f26eb28a90737396e7dfca92
   
   I removed
   ```
   NSData* data_content = [self.data mutableCopy];
   ```
   and added instead
   ```
   UIImage *image = [UIImage imageWithData:self.data];
   CGImageRef imageRef = image.CGImage;
   ```
   plus I replaced this line
   ```
    CGImageDestinationAddImageFromSource(destinationImage, sourceImage, 0, (__bridge CFDictionaryRef)self.metadata);
   ```
   with this line
   ```
   CGImageDestinationAddImage(destinationImage , imageRef, (CFDictionaryRef)self.metadata);
   ```
   2) I also tried the fix as suggested by @mevinDhun 
   
   Both fixes seems to be working.
   
   I'm still wondering why CGImageDestinationAddImageFromSource fails while CGImageDestinationAddImage works fine when saving the image with the metadata. Any ideas?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org