I've been searching for a solution to this for some time and believe that it, at it's core, isn't possible.
I'm wondering if anybody has found a decent hack or bypass.
My issue is this:
I have an app that captures a photo, then that photo is used as a canvas that the user can tap on to place tags.
After the tags are placed the user uploads the photos and the tags get submitted to a client service for parsing.
If the photo is taken in landscape I need to detect if it's landscape left or landscape right so that I can display it at the proper orientation when it gets to the canvas, and flip it the proper direction if the user changes to the opposite landscape mode.
How could I capture the orientation that the photo was taken in?
function getOrientation(o) {
switch (o){
case Titanium.UI.PORTRAIT:
return 'portrait';
case Titanium.UI.UPSIDE_PORTRAIT:
return 'upside portrait';
case Titanium.UI.LANDSCAPE_LEFT:
return 'landscape left';
case Titanium.UI.LANDSCAPE_RIGHT:
return 'landscape right';
case Titanium.UI.FACE_UP:
return 'face up';
case Titanium.UI.FACE_DOWN:
return 'face down';
case Titanium.UI.UNKNOWN:
return 'unknown';
}
}
}
Ti.Gesture.addEventListener('orientationchange',function(e){
Ti.API.info('Current Orientation: ' + getOrientation(Titanium.Gesture.orientation));
var orientation = getOrientation(e.orientation);
Titanium.API.info(
"orientation changed = "+orientation+", is portrait?"+e.source.isPortrait()+", orientation = "+Ti.Gesture.orientation + "is landscape?"+e.source.isLandscape()
);
});
modified a bit from the KS but should do the trick.
this should do what the above doesn't
Titanium.Media.showCamera({
success:function(event) {
var orientationWhilePictureTaken = Ti.Gesture.orientation;
// all other camera code...
}
});