Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-4078

correctOrientation is not working on camera.getPicture for PHOTOLIBRARY (works with Camera)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.0
    • Fix Version/s: None
    • Component/s: cordova-plugin-camera
    • Labels:
    • Environment:

      Android

      Description

      Hi

      I use cameraOptions below to get the FILE_URI and to display in <img> tag:

            correctOrientation: true
            quality: 50
            encodingType: Camera.EncodingType.JPEG
            targetWidth: 300
            targetHeight: 300
            destinationType: window.navigator.camera.DestinationType.FILE_URI
            sourceType: window.navigator.camera.PictureSourceType.PHOTOLIBRARY
      

      But the picture displayed within wrong orientation.

      Updated:
      I try use window.navigator.camera.PictureSourceType.CAMERA in sourceType, and everything work as expected.

        Activity

        Hide
        Clément Vollet Clément Vollet added a comment - - edited

        EDIT: I did not see this bug was for iOS. I don't have this problem on the iOS version of the app I'm building, only in the Android version. Sorry for the confusion, I'll open a new bug.

        I also encounter this bug.

        What I've find out is that requesting the orientation via the MediaStore gives a different result than with the ExifHelper. In case of a portrait pic, the MediaStore returns 90, when reading the exif infos gives 0 as expected.

        I tried to fix it by requesting the info from Exif only (as a test only), but some pictures get a wrong orientation then (typically, pictures downloaded from the web). For pictures taken with the camera and accessed through the Gallery, it seemed to work.

        However, and that is the big "WTF is happening?!" for me, after rebooting the phone, I was getting exactly the opposite results (pic taken from the camera have the wrong exif data and other the right one, with a nice symmetry on the MediaStore side, where it's the opposite...).

        So, I'm a bit confused, and any help would be appreciated. The last thing I tried was to force the MediaStore to update (with MediaScannerConnection.scanFile), with no luck (maybe it's totally wrong to do that though, I was trying all I could think of).

        I'm available for testing possible solutions, and will give it another go on monday anyway.

        So, any idea is welcomed

        Show
        Clément Vollet Clément Vollet added a comment - - edited EDIT: I did not see this bug was for iOS. I don't have this problem on the iOS version of the app I'm building, only in the Android version. Sorry for the confusion, I'll open a new bug. I also encounter this bug. What I've find out is that requesting the orientation via the MediaStore gives a different result than with the ExifHelper. In case of a portrait pic, the MediaStore returns 90, when reading the exif infos gives 0 as expected. I tried to fix it by requesting the info from Exif only (as a test only), but some pictures get a wrong orientation then (typically, pictures downloaded from the web). For pictures taken with the camera and accessed through the Gallery, it seemed to work. However, and that is the big "WTF is happening?!" for me, after rebooting the phone, I was getting exactly the opposite results (pic taken from the camera have the wrong exif data and other the right one, with a nice symmetry on the MediaStore side, where it's the opposite...). So, I'm a bit confused, and any help would be appreciated. The last thing I tried was to force the MediaStore to update (with MediaScannerConnection.scanFile), with no luck (maybe it's totally wrong to do that though, I was trying all I could think of). I'm available for testing possible solutions, and will give it another go on monday anyway. So, any idea is welcomed
        Hide
        Bnaya Bnaya added a comment -

        I have this issue in android and not IOS.
        This commit fixes the issue:
        https://github.com/photomania/cordova-plugin-camera/commit/cbb3e5011bb04245b421ba6cd9ad456904bf7ef9
        I hope to PR it soon

        Show
        Bnaya Bnaya added a comment - I have this issue in android and not IOS. This commit fixes the issue: https://github.com/photomania/cordova-plugin-camera/commit/cbb3e5011bb04245b421ba6cd9ad456904bf7ef9 I hope to PR it soon
        Hide
        martindederer Martin Dederer added a comment -

        How is the PR coming along? I discovered the very same issue and luckily found your "android-gallery-orientation-fix" branch. It would be a shame if the fixes would not be incorporated into upstream.

        Show
        martindederer Martin Dederer added a comment - How is the PR coming along? I discovered the very same issue and luckily found your "android-gallery-orientation-fix" branch. It would be a shame if the fixes would not be incorporated into upstream.
        Hide
        Bnaya Bnaya added a comment -

        I haven't find the time to finalize the code and i'm not sure how i can signed the contributor agreement as my company.
        Ill try to rebase my fix from time to time, glad you found it usefull

        Show
        Bnaya Bnaya added a comment - I haven't find the time to finalize the code and i'm not sure how i can signed the contributor agreement as my company. Ill try to rebase my fix from time to time, glad you found it usefull
        Hide
        Jbean Janet B added a comment -

        There seems to be nothing further addressed about this. My guess is that people have been simply implementing a manual rotation feature, but it would be nice if it just worked.

        Show
        Jbean Janet B added a comment - There seems to be nothing further addressed about this. My guess is that people have been simply implementing a manual rotation feature, but it would be nice if it just worked.
        Hide
        riknoll Richard B Knoll added a comment -

        I can't reproduce this in iOS. aligo are you still experiencing it in iOS? I have added the Android label to this issue as well.

        Show
        riknoll Richard B Knoll added a comment - I can't reproduce this in iOS. aligo are you still experiencing it in iOS? I have added the Android label to this issue as well.
        Hide
        jcesarmobile jcesarmobile added a comment -

        I'm not sure how correctOrientation is supposed to work
        In my tests, the images are displayed on the app with the same orientation they were taken and the same orientation they show on the Photos app

        Show
        jcesarmobile jcesarmobile added a comment - I'm not sure how correctOrientation is supposed to work In my tests, the images are displayed on the app with the same orientation they were taken and the same orientation they show on the Photos app
        Hide
        Jbean Janet B added a comment - - edited

        It works fine in iOS (confirmed for 8.4+), but not for Android. Photos from the library are not properly rotated, as the ticket details explain. To be more specific, photos that were taken by the camera in portait mode (have a 90° orientation) are rotated to the left 90 degrees when uploaded by the plugin.

        Show
        Jbean Janet B added a comment - - edited It works fine in iOS (confirmed for 8.4+), but not for Android. Photos from the library are not properly rotated, as the ticket details explain. To be more specific, photos that were taken by the camera in portait mode (have a 90° orientation) are rotated to the left 90 degrees when uploaded by the plugin.
        Hide
        riknoll Richard B Knoll added a comment -

        I think the issue might be related to some camera apps on Android phones not correctly setting the rotation in the photo's EXIF data. Looking around JIRA, it seems to be an issue that only happens for some people and not for others. Unfortunately, I don't know if there is much we can do about that since we don't control the native camera application.

        Show
        riknoll Richard B Knoll added a comment - I think the issue might be related to some camera apps on Android phones not correctly setting the rotation in the photo's EXIF data. Looking around JIRA, it seems to be an issue that only happens for some people and not for others. Unfortunately, I don't know if there is much we can do about that since we don't control the native camera application.
        Hide
        Bnaya Bnaya added a comment -

        this commit fixes that issue,
        https://github.com/photomania/cordova-plugin-camera/commit/cbb3e5011bb04245b421ba6cd9ad456904bf7ef9
        you need to turn the content uri to file system uri if you want to read the exif data.

        Show
        Bnaya Bnaya added a comment - this commit fixes that issue, https://github.com/photomania/cordova-plugin-camera/commit/cbb3e5011bb04245b421ba6cd9ad456904bf7ef9 you need to turn the content uri to file system uri if you want to read the exif data.
        Hide
        riknoll Richard B Knoll added a comment -

        It would be great to see this as a pull request. I'll admit I am not that familiar with the corporate CLA process, but the dev list might be able to provide some guidance.

        Show
        riknoll Richard B Knoll added a comment - It would be great to see this as a pull request. I'll admit I am not that familiar with the corporate CLA process, but the dev list might be able to provide some guidance.
        Hide
        Bnaya Bnaya added a comment -

        Also this fix have some possible problems, but works for our app most of the time.
        You need a work of a dedicated android developer to cover all of the edge cases
        This PR is a similar fix but i'm not sure also if its a complete one.
        https://github.com/apache/cordova-plugin-camera/pull/93/files

        Show
        Bnaya Bnaya added a comment - Also this fix have some possible problems, but works for our app most of the time. You need a work of a dedicated android developer to cover all of the edge cases This PR is a similar fix but i'm not sure also if its a complete one. https://github.com/apache/cordova-plugin-camera/pull/93/files
        Hide
        swbradshaw Scott Bradshaw added a comment -

        I was able to reproduce this issue today and spent hours trying to figure out what's going on.

        The problem is easy to reproduce. On Android 4.4+ devices, the PHOTOLIBRARY option won't return the photo rotated. When ACTION_GET_CONTENT Intent is used, as opposed to ACTION_PICK on KitKat, the new Documents Activity is shown to allow the user to choose an image. Once an image is selected, the plugin trys to query for Images.Media.ORIENTATION directly on the documents uri, but that always returns 0. The fix is fairly simple; you first extract the id out and use it on the MediaStore, and then the query returns the correct orientation.

        I corrected this locally with a custom camera plugin I'm working on to do face detection. I'll see if I can fork the official plugin to fix it and do a pull request.

        Show
        swbradshaw Scott Bradshaw added a comment - I was able to reproduce this issue today and spent hours trying to figure out what's going on. The problem is easy to reproduce. On Android 4.4+ devices, the PHOTOLIBRARY option won't return the photo rotated. When ACTION_GET_CONTENT Intent is used, as opposed to ACTION_PICK on KitKat, the new Documents Activity is shown to allow the user to choose an image. Once an image is selected, the plugin trys to query for Images.Media.ORIENTATION directly on the documents uri, but that always returns 0. The fix is fairly simple; you first extract the id out and use it on the MediaStore, and then the query returns the correct orientation. I corrected this locally with a custom camera plugin I'm working on to do face detection. I'll see if I can fork the official plugin to fix it and do a pull request.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user swbradshaw opened a pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197

        CB-4078: correctOrientation not working on camera.getPicture for PHOTOLIBRARY

        This fixes the orientation bug for Android 4.4+ devices when choosing a picture from the photo library.

        This fixes both DATA_URL and FILE_URI requests.

        Tested on Android 4.0.4, Android 5.02, and Android 5.1 devices.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/swbradshaw/cordova-plugin-camera master

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/cordova-plugin-camera/pull/197.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #197


        commit c0e9210b56ece1b239261f91e11569aba9d696fa
        Author: swbradshaw <swbradshaw@gmail.com>
        Date: 2016-03-24T00:15:10Z

        Fix for image rotation on Android 4.4+ devices


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user swbradshaw opened a pull request: https://github.com/apache/cordova-plugin-camera/pull/197 CB-4078 : correctOrientation not working on camera.getPicture for PHOTOLIBRARY This fixes the orientation bug for Android 4.4+ devices when choosing a picture from the photo library. This fixes both DATA_URL and FILE_URI requests. Tested on Android 4.0.4, Android 5.02, and Android 5.1 devices. You can merge this pull request into a Git repository by running: $ git pull https://github.com/swbradshaw/cordova-plugin-camera master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-camera/pull/197.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #197 commit c0e9210b56ece1b239261f91e11569aba9d696fa Author: swbradshaw <swbradshaw@gmail.com> Date: 2016-03-24T00:15:10Z Fix for image rotation on Android 4.4+ devices
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user kukikiloke commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-200909071

        @swbradshaw what devices did you see this issue?

        I am seeing similar issue only on Samsung devices (S6 5.1.1 and S3 5.1.1) that selecting a photo taken in portrait from photo library does not correct the orientation (displayed in landscape)

        Show
        githubbot ASF GitHub Bot added a comment - Github user kukikiloke commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-200909071 @swbradshaw what devices did you see this issue? I am seeing similar issue only on Samsung devices (S6 5.1.1 and S3 5.1.1) that selecting a photo taken in portrait from photo library does not correct the orientation (displayed in landscape)
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-200913136

        I personally saw the issue on on LG G2(5.0.2) and LG V10 (5.1).

        I believe it affects all devices running Android 4.4 and newer because the existing code won't correctly pull the orientation from the MediaStore on API19+

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-200913136 I personally saw the issue on on LG G2(5.0.2) and LG V10 (5.1). I believe it affects all devices running Android 4.4 and newer because the existing code won't correctly pull the orientation from the MediaStore on API19+
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user riknoll commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201508149

        @swbradshaw What gallery apps did you test against?

        Show
        githubbot ASF GitHub Bot added a comment - Github user riknoll commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201508149 @swbradshaw What gallery apps did you test against?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201534121

        @riknoll - Can you clarify?

        Are you referring to the apps that have implement the DocumentsProvider interface that show up on the unified UI picker on 4.4+ devices? If so, I tested the default picker provided by Android. If you try to test another 3rd party one, it doesn't work. This doesn't work in the master branch, either. This is due to a bug with the "ouputModifiedBitmap" function where it won't correctly generate a filename when the user picks a path that comes back from a 3rd party URI returned by Android's DocumentProvider. This push request isn't addressing that issue, but I can certainly fix that one as well if its been logged. (The spelling error in that function name is driving me crazy, too).

        OR are you referring to pre-4.4 devices that prompt the user to pick an app to choose an image from? If this is the case, the code should handle these the same way it has done in the past.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201534121 @riknoll - Can you clarify? Are you referring to the apps that have implement the DocumentsProvider interface that show up on the unified UI picker on 4.4+ devices? If so, I tested the default picker provided by Android. If you try to test another 3rd party one, it doesn't work. This doesn't work in the master branch, either. This is due to a bug with the "ouputModifiedBitmap" function where it won't correctly generate a filename when the user picks a path that comes back from a 3rd party URI returned by Android's DocumentProvider. This push request isn't addressing that issue, but I can certainly fix that one as well if its been logged. (The spelling error in that function name is driving me crazy, too). OR are you referring to pre-4.4 devices that prompt the user to pick an app to choose an image from? If this is the case, the code should handle these the same way it has done in the past.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user riknoll commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201542091

        We support Google Photos and the stock Gallery app as far as I know. Have you tested recently? There were some changes to how we dereference URIs (though Google Drive still does not work). Mainly, I just wanted to check to make sure that you had verified this change with photos selected using both Google Photos and the stock Gallery app. I think the `ouputModifiedBitmap()` bug should be fixed in master (+1 on misspelling BTW) .

        Show
        githubbot ASF GitHub Bot added a comment - Github user riknoll commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201542091 We support Google Photos and the stock Gallery app as far as I know. Have you tested recently? There were some changes to how we dereference URIs (though Google Drive still does not work). Mainly, I just wanted to check to make sure that you had verified this change with photos selected using both Google Photos and the stock Gallery app. I think the `ouputModifiedBitmap()` bug should be fixed in master (+1 on misspelling BTW) .
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201565769

        `ouputModifiedBitmap()` is not fixed in master. `getRealPathFromURI_API19()` in FileHelper returns an empty string and thus the fileName cannot be generated for the temp file. I just tested this 5 minutes ago.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201565769 `ouputModifiedBitmap()` is not fixed in master. `getRealPathFromURI_API19()` in FileHelper returns an empty string and thus the fileName cannot be generated for the temp file. I just tested this 5 minutes ago.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201567303

        Should I go ahead and fix `ouputModifiedBitmap()` for this pull request? The reality is now that orientation is fixed, this is going to cause that function to get called more because the image will need to be rotated for output.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201567303 Should I go ahead and fix `ouputModifiedBitmap()` for this pull request? The reality is now that orientation is fixed, this is going to cause that function to get called more because the image will need to be rotated for output.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user riknoll commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201572664

        If you have a fix in mind that would be great! I think there might already be a JIRA for that as well.

        Show
        githubbot ASF GitHub Bot added a comment - Github user riknoll commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201572664 If you have a fix in mind that would be great! I think there might already be a JIRA for that as well.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201611674

        @riknoll - I found the changes you were talking about. The changes in CB-10460 will make the `ouputModifiedBitmap()` function correctly because the FileHelper will now return null, which is what it was expecting. There are no further changes on my side needed. With this change and CB-10460 combined, I can now pick photos from any Document Provider (Drive, Gallery, Photos, QuickPic) and it will successfully correct the orientation and resize the photo.

        One suggestion I have is to rename CB-10460 to something like "Choosing pictures from 3rd party provider (Gallery, Photo, Drive) will result in error". If the current title is published on the blog, users aren't going to know what "getRealPath return null in some cases" means.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201611674 @riknoll - I found the changes you were talking about. The changes in CB-10460 will make the `ouputModifiedBitmap()` function correctly because the FileHelper will now return null, which is what it was expecting. There are no further changes on my side needed. With this change and CB-10460 combined, I can now pick photos from any Document Provider (Drive, Gallery, Photos, QuickPic) and it will successfully correct the orientation and resize the photo. One suggestion I have is to rename CB-10460 to something like "Choosing pictures from 3rd party provider (Gallery, Photo, Drive) will result in error". If the current title is published on the blog, users aren't going to know what "getRealPath return null in some cases" means.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user riknoll commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201619442

        Our release notes actually come from the commit messages themselves (so no going back, I'm afraid)

        Show
        githubbot ASF GitHub Bot added a comment - Github user riknoll commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-201619442 Our release notes actually come from the commit messages themselves (so no going back, I'm afraid)
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203796836

        @swbradshaw I used your code but unable to get the rotated image from drive, dropbox and
        as well as from the internal storage(see attachment), i tested on Samsung Galaxy S6 with Android v5.1.1.
        Any solution for that?

        ![screenshot_2016-03-31-12-34-32](https://cloud.githubusercontent.com/assets/15194593/14168544/8afb64c8-f740-11e5-9940-2279a4a6a793.png)

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203796836 @swbradshaw I used your code but unable to get the rotated image from drive, dropbox and as well as from the internal storage(see attachment), i tested on Samsung Galaxy S6 with Android v5.1.1. Any solution for that? ! [screenshot_2016-03-31-12-34-32] ( https://cloud.githubusercontent.com/assets/15194593/14168544/8afb64c8-f740-11e5-9940-2279a4a6a793.png )
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203883218

        @unbeatableDeepak Grab the changes in CB-10460 as well and that should fix your issue. Please verify.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203883218 @unbeatableDeepak Grab the changes in CB-10460 as well and that should fix your issue. Please verify.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203884755

        @swbradshaw can you please give me the link?

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203884755 @swbradshaw can you please give me the link?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203886789

        @unbeatableDeepak please see this pull request:
        https://github.com/apache/cordova-plugin-camera/pull/194

        Can you please provide the code you are using? Internal storage should work.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203886789 @unbeatableDeepak please see this pull request: https://github.com/apache/cordova-plugin-camera/pull/194 Can you please provide the code you are using? Internal storage should work.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203888824

        [Archive.zip](https://github.com/apache/cordova-plugin-camera/files/197505/Archive.zip)
        This is my code and its same as yours and CB-10460 changes is also there.

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203888824 [Archive.zip] ( https://github.com/apache/cordova-plugin-camera/files/197505/Archive.zip ) This is my code and its same as yours and CB-10460 changes is also there.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203919964

        @unbeatableDeepak Thanks. I was referring to your JS code. I would like to reproduce what you are seeing on my side with the same options you are calling to the plugin.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203919964 @unbeatableDeepak Thanks. I was referring to your JS code. I would like to reproduce what you are seeing on my side with the same options you are calling to the plugin.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203968527

        @unbeatableDeepak I was able to reproduce your issues. I'll take a look to see how I can fix this.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203968527 @unbeatableDeepak I was able to reproduce your issues. I'll take a look to see how I can fix this.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203976877

        @swbradshaw That's great.
        When I debugged this issue I found that getRotationFromMediaStoreAPI19() is unable to get the orientation of the image for internal storage path. Also can you please check the issue for 3rd party apps?

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-203976877 @swbradshaw That's great. When I debugged this issue I found that getRotationFromMediaStoreAPI19() is unable to get the orientation of the image for internal storage path. Also can you please check the issue for 3rd party apps?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-204252555

        @swbradshaw I forgot to give you my JS code, these are the options which I used:

        navigator.camera.getPicture(function(imageUrl)

        { console.log("Image Data ::: "+imageUrl); }

        , function(err)

        { console.log("Error ::: "+err); }

        ,

        { quality : 50, destinationType : navigator.camera.DestinationType.FILE_URI, sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY, mediaType : navigator.camera.MediaType.PICTURE, correctOrientation : true }

        );

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-204252555 @swbradshaw I forgot to give you my JS code, these are the options which I used: navigator.camera.getPicture(function(imageUrl) { console.log("Image Data ::: "+imageUrl); } , function(err) { console.log("Error ::: "+err); } , { quality : 50, destinationType : navigator.camera.DestinationType.FILE_URI, sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY, mediaType : navigator.camera.MediaType.PICTURE, correctOrientation : true } );
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205139319

        @swbradshaw Hi, did you get any solution yet?

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205139319 @swbradshaw Hi, did you get any solution yet?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205285417

        @unbeatableDeepak I have a solution coded, but I haven't had a chance to test it yet.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205285417 @unbeatableDeepak I have a solution coded, but I haven't had a chance to test it yet.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205367729

        @swbradshaw That's great! If you don't have time then I can do the testing of your code and will let you know the result, can you please provide me your code so that I can test it.

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-205367729 @swbradshaw That's great! If you don't have time then I can do the testing of your code and will let you know the result, can you please provide me your code so that I can test it.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user unbeatableDeepak commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-208319501

        @swbradshaw if your code is working please share it with me, my app's new release is pending due to this issue.
        Thanks in advance.

        Show
        githubbot ASF GitHub Bot added a comment - Github user unbeatableDeepak commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-208319501 @swbradshaw if your code is working please share it with me, my app's new release is pending due to this issue. Thanks in advance.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-215287391

        @unbeatableDeepak My changes have been committed. I did a rebase from the master since I was weeks behind. Since this is my first PR, I'm not sure if that was correct or not. Anyway, you can test now.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-215287391 @unbeatableDeepak My changes have been committed. I did a rebase from the master since I was weeks behind. Since this is my first PR, I'm not sure if that was correct or not. Anyway, you can test now.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw closed the pull request at:

        https://github.com/apache/cordova-plugin-camera/pull/197

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw closed the pull request at: https://github.com/apache/cordova-plugin-camera/pull/197
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swbradshaw commented on the pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-215290093

        Re-opening with cleaned up fork.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swbradshaw commented on the pull request: https://github.com/apache/cordova-plugin-camera/pull/197#issuecomment-215290093 Re-opening with cleaned up fork.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user swbradshaw reopened a pull request:

        https://github.com/apache/cordova-plugin-camera/pull/197

        CB-4078: correctOrientation not working on camera.getPicture for PHOTOLIBRARY

        This fixes the orientation bug for Android 4.4+ devices when choosing a picture from the photo library.

        This fixes both DATA_URL and FILE_URI requests.

        Tested on Android 4.0.4, Android 5.02, and Android 5.1 devices.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/swbradshaw/cordova-plugin-camera master

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/cordova-plugin-camera/pull/197.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #197


        commit f2b4eeded069d791aec0670b369bab8fb3bfd0eb
        Author: swbradshaw <swbradshaw@gmail.com>
        Date: 2016-04-28T02:27:37Z

        CB-4078: Fix for orientation/scaling on Android 4.4+ devices

        The only way to get rotation for photos in library (Gallery, File
        System, Google Drive,etc) is to first create a temporary file from the
        provider. Only then can we determine the orientation and scale the
        bitmap correctly. By doing it in a central place, it eliminates reading
        the inputstream repetitively in the plugin.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user swbradshaw reopened a pull request: https://github.com/apache/cordova-plugin-camera/pull/197 CB-4078 : correctOrientation not working on camera.getPicture for PHOTOLIBRARY This fixes the orientation bug for Android 4.4+ devices when choosing a picture from the photo library. This fixes both DATA_URL and FILE_URI requests. Tested on Android 4.0.4, Android 5.02, and Android 5.1 devices. You can merge this pull request into a Git repository by running: $ git pull https://github.com/swbradshaw/cordova-plugin-camera master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-camera/pull/197.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #197 commit f2b4eeded069d791aec0670b369bab8fb3bfd0eb Author: swbradshaw <swbradshaw@gmail.com> Date: 2016-04-28T02:27:37Z CB-4078 : Fix for orientation/scaling on Android 4.4+ devices The only way to get rotation for photos in library (Gallery, File System, Google Drive,etc) is to first create a temporary file from the provider. Only then can we determine the orientation and scale the bitmap correctly. By doing it in a central place, it eliminates reading the inputstream repetitively in the plugin.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit f2b4eeded069d791aec0670b369bab8fb3bfd0eb in cordova-plugin-camera's branch refs/heads/master from Scott Bradshaw
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-camera.git;h=f2b4eed ]

        CB-4078: Fix for orientation/scaling on Android 4.4+ devices

        The only way to get rotation for photos in library (Gallery, File
        System, Google Drive,etc) is to first create a temporary file from the
        provider. Only then can we determine the orientation and scale the
        bitmap correctly. By doing it in a central place, it eliminates reading
        the inputstream repetitively in the plugin.

        Show
        jira-bot ASF subversion and git services added a comment - Commit f2b4eeded069d791aec0670b369bab8fb3bfd0eb in cordova-plugin-camera's branch refs/heads/master from Scott Bradshaw [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-camera.git;h=f2b4eed ] CB-4078 : Fix for orientation/scaling on Android 4.4+ devices The only way to get rotation for photos in library (Gallery, File System, Google Drive,etc) is to first create a temporary file from the provider. Only then can we determine the orientation and scale the bitmap correctly. By doing it in a central place, it eliminates reading the inputstream repetitively in the plugin.

          People

          • Assignee:
            Unassigned
            Reporter:
            aligo aligo
          • Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development