diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index bf02ca2e6..7a8e2f183 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -493,7 +493,10 @@ - (void)resultForImage:(CDVPictureOptions*)options info:(NSDictionary*)info comp image = [self retrieveImage:info options:options]; NSData* data = [self processImage:image info:info options:options]; if (data) { - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:toBase64(data)]; + NSString* extension = options.encodingType == EncodingTypePNG? @"image/png" : @"image/jpeg"; + NSString* finalURI = [NSString stringWithFormat:@"%@%@%@%@", @"data:", extension, @";base64,", toBase64(data)]; + + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:finalURI]; } } break; @@ -701,7 +704,10 @@ - (void)imagePickerControllerReturnImageResult break; case DestinationTypeDataUrl: { - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:toBase64(self.data)]; + NSString* extension = self.pickerController.pictureOptions.encodingType == EncodingTypePNG ? @"image/png" : @"image/jpeg"; + NSString* finalURI = [NSString stringWithFormat:@"%@%@%@%@", @"data:", extension, @";base64,", toBase64(self.data)]; + + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:finalURI]; } break; case DestinationTypeNativeUri: