You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Cedric Bertolasio (JIRA)" <ji...@apache.org> on 2012/09/25 18:36:07 UTC

[jira] [Updated] (CB-1540) camera image is rotated 90 degrees left when destinationType is FILE_URI

     [ https://issues.apache.org/jira/browse/CB-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cedric Bertolasio updated CB-1540:
----------------------------------

    Description: 
When the sourceType is Camera and destinationType is FILE_URI and the FILE_URI is used as the src of an img tag the img that is rendered is rotated 90 degrees left.


Using the camera api as a basis for my code  (http://docs.phonegap.com/en/2.1.0/cordova_camera_camera.md.html#Camera)  

I created a simple app that does the following:
- click a button 
- camera is opened 
- photo is captured
- FILE_URI returned from getPicture is used as SRC attribute of an img tag
- image is rendered on screen 

An interesting note is that if you use the base64 data that is returned - the image is NOT displayed in the proper orientation.  

The uri that is being returned is from the camera cache.  When sourceType is set to Photolibrary - the file uri that is returned points to the photo album (not the camera cache) AND the image is rendered properly. 

This code can be used to reproduce the issue:
function capturePhoto() {
            
    // original sample - renders base64 data to screen
//  navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
//  destinationType: destinationType.DATA_URL
//  });


    // sample that causes image to be rotated...
    navigator.camera.getPicture(onPhotoURISuccess, onFail, {
        quality: 50,
        destinationType: destinationType.FILE_URI
        //, saveToPhotoAlbum: true
    });
}


  was:
When the sourceType is Camera and destinationType is FILE_URI and the FILE_URI is used as the src of an img tag the img that is rendered is rotated 90 degrees left.


Using the camera api as a basis for my code  (http://docs.phonegap.com/en/2.1.0/cordova_camera_camera.md.html#Camera)  

I created a simple app that does the following:
- click a button 
- camera is opened 
- photo is captured
- FILE_URI returned from getPicture is used as SRC attribute of an img tag
- image is rendered on screen 

An interesting note is that if you use the base64 data that is returned - then the image is properly rotated.  

The uri that is being returned is from the camera cache.  When sourceType is set to Photolibrary - the file uri that is returned points to the photo album (not the camera cache) AND the image is rendered properly. 

This code can be used to reproduce the issue:
function capturePhoto() {
            
    // original sample - renders base64 data to screen
//  navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
//  destinationType: destinationType.DATA_URL
//  });


    // sample that causes image to be rotated...
    navigator.camera.getPicture(onPhotoURISuccess, onFail, {
        quality: 50,
        destinationType: destinationType.FILE_URI
        //, saveToPhotoAlbum: true
    });
}


    
> camera image is rotated 90 degrees left when destinationType is FILE_URI
> ------------------------------------------------------------------------
>
>                 Key: CB-1540
>                 URL: https://issues.apache.org/jira/browse/CB-1540
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP7
>    Affects Versions: 2.1.0
>         Environment: wp7 emulator w/ all service packs & hotfixes installed, also on nokia lumia 900 w/ wp7.5 & all service packs and updates installed
>            Reporter: Cedric Bertolasio
>            Assignee: Jesse MacFadyen
>            Priority: Critical
>              Labels: camera, image, orientation
>
> When the sourceType is Camera and destinationType is FILE_URI and the FILE_URI is used as the src of an img tag the img that is rendered is rotated 90 degrees left.
> Using the camera api as a basis for my code  (http://docs.phonegap.com/en/2.1.0/cordova_camera_camera.md.html#Camera)  
> I created a simple app that does the following:
> - click a button 
> - camera is opened 
> - photo is captured
> - FILE_URI returned from getPicture is used as SRC attribute of an img tag
> - image is rendered on screen 
> An interesting note is that if you use the base64 data that is returned - the image is NOT displayed in the proper orientation.  
> The uri that is being returned is from the camera cache.  When sourceType is set to Photolibrary - the file uri that is returned points to the photo album (not the camera cache) AND the image is rendered properly. 
> This code can be used to reproduce the issue:
> function capturePhoto() {
>             
>     // original sample - renders base64 data to screen
> //  navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
> //  destinationType: destinationType.DATA_URL
> //  });
>     // sample that causes image to be rotated...
>     navigator.camera.getPicture(onPhotoURISuccess, onFail, {
>         quality: 50,
>         destinationType: destinationType.FILE_URI
>         //, saveToPhotoAlbum: true
>     });
> }

--
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