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

[jira] [Comment Edited] (CB-1246) camera.getPicture should keep original date and orientation

    [ https://issues.apache.org/jira/browse/CB-1246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459336#comment-13459336 ] 

Lorin Beer edited comment on CB-1246 at 9/21/12 3:34 AM:
---------------------------------------------------------

Hi George,

you can access the hack on my fork here:

https://github.com/lorinbeer/incubator-cordova-ios/tree/CB-1246

the only change is in CDVCamera.m, which returns a json string with the file uli and image metadata, instead of just the uli. Note that this breaks expected behaviour and isn't a final solution.

exif data key: "{Exif}" 
tiff data key: "{TIFF}"

Here's an example of how to use the new return value
bq.
navigator.camera.getPicture( 
function(data) {
    var img = document.getElementById('camera_image');
    img.style.visibility = "visible";
    img.style.display = "block";
    //parse and display the entire metadata block
    data = JSON.parse(data);
    console.log(data);
    //access file uli
    img.src = data.file_uri;
    document.getElementById('camera_status').innerHTML = "Success";
    },
    function(e) {
    console.log("Error getting picture: " + e);
    document.getElementById('camera_status').innerHTML = "Error getting picture.";
    },
    { quality: 50, destinationType:
      Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.CAMERA});
};


                
      was (Author: lorin.beer):
    Hi George,

you can access the hack on my fork here:

https://github.com/lorinbeer/incubator-cordova-ios/tree/CB-1246

the only change is in CDVCamera.m, which returns a json string with the file uli and image metadata, instead of just the uli. Note that this breaks expected behaviour and isn't a final solution.

exif data key: "{Exif}" 
tiff data key: "{TIFF}"

Here's an example of how to use the new return value

        navigator.camera.getPicture(
            function(data) {
                var img = document.getElementById('camera_image');
                img.style.visibility = "visible";
                img.style.display = "block";
                //parse and display the entire metadata block
                data = JSON.parse(data);
                console.log(data);
                //access file uli
                img.src = data.file_uri;
                document.getElementById('camera_status').innerHTML = "Success";
            },
            function(e) {
                console.log("Error getting picture: " + e);
                document.getElementById('camera_status').innerHTML = "Error getting picture.";
            },
            { quality: 50, destinationType:
            Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.CAMERA});
    };


                  
> camera.getPicture should keep original date and orientation
> -----------------------------------------------------------
>
>                 Key: CB-1246
>                 URL: https://issues.apache.org/jira/browse/CB-1246
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: iOS
>    Affects Versions: 1.7.0
>            Reporter: George Burrows
>            Assignee: Lorin Beer
>              Labels: newbie
>             Fix For: 2.2.0
>
>
> When getting a resized image from camera.getPicture(), the exif data is stripped out (which I understand is a hard thing to keep). However it would really help if we knew the original date that the photo was taken. Are we able to get either the lastmodified date of the original image passed through in the success method, or even better send through the exif value for date created?
> Thanks for your help,
> George

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