Github user omefire commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-camera/pull/185#discussion_r54685843
  
    --- Diff: src/ios/CDVCamera.m ---
    @@ -402,6 +444,115 @@ - (NSString*)tempFilePath:(NSString*)extension
         return filePath;
     }
     
    +// This is not absolute, but more mightNeedOrientationCorrection
    +- (BOOL) needsOrientationCorrection:(UIImage*)image 
options:(CDVPictureOptions*)options
    +{
    +    // TODO use image to detect if it needs an orientation correction
    +
    +    // See FIXME #2
    +    //    if (options.sourceType != 
UIImagePickerControllerSourceTypeCamera) {
    +    //        return false;
    +    //    }
    +    return options.correctOrientation;
    +}
    +
    +- (BOOL) needsResize:(CDVPictureOptions*)options
    +{
    +    return (options.targetSize.height > 0 && options.targetSize.width > 0);
    +}
    +
    +- (BOOL) needsEdit:(UIImage*)image options:(CDVPictureOptions*)options
    +{
    +    return [self needsOrientationCorrection:image options:options] || 
[self needsResize:options];
    +}
    +
    +- (BOOL) needsSavingToPhotoAlbum:(UIImage*)image 
options:(CDVPictureOptions*)options
    +{
    +    /*
    +     We save to the photo album if:
    +     - the option is set
    +     - the image is fetch from the camera OR the image has been edited (no 
need to duplicate image in the library)
    +     */
    +    BOOL isSourceCamera = options.sourceType == 
UIImagePickerControllerSourceTypeCamera;
    +    BOOL saveToPhotoAlbum = options.saveToPhotoAlbum && ([self 
needsEdit:image options:options] || isSourceCamera);
    +    
    +    return saveToPhotoAlbum;
    +}
    +
    +/*
    + Metadata is not needed for:
    + - source: gallery
    + - destination: NATIVE_URI
    + - no edit (not orientation and not resize and not allowEdits)
    + 
    + otherwise, it can be found:
    + - source: camera
    + => UIImagePickerControllerMediaMetadata
    + - source: gallery
    + => CGImage thingy
    + */
    +
    +// resultForImage:
    +//      retrieve image, OK
    +//      edit image (orientation + resize) and metadata OK
    +//      if (geoLoc)
    +//          save on self.{data, metadata}
    +//          wait for geoLoc
    +//      else
    +//          saveAndResult
    +//
    +// saveAndResult:
    +//      saveToPhotoAlbum if needed (options.saveToPhotoAlbum && !(gallery 
&& NATIVE_URI))
    +//      send back the image URI
    +- (void)didReceiveImage:(CDVPictureOptions*)options 
info:(NSDictionary*)info
    --- End diff --
    
    For consistency's sake, use the same naming convention for both image 
results and video results. (cf: 'resultForVideo')


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to