[TIMOB-16287] iOS: image taken in landscape orients itself to portrait
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.2.1 |
Fix Version/s | n/a |
Components | iOS |
Labels | camera, qe-3.2.1 |
Reporter | Pragya Rastogi |
Assignee | Unknown |
Created | 2014-01-22T10:35:34.000+0000 |
Updated | 2018-02-28T20:03:22.000+0000 |
Description
Image taken in landscape orients itself to portrait. This occurs in SDK:3.2.0.GA & 3.1.3.GA as well, Hence not a regression
Steps To Reproduce:
1. Create app using below code.
2. Run app
3. In landscape orientation, click picture
Actual: Picture orients itself in portrait mode.
Expected: Picture must remain in landscape mode until orientation is changed
var _window = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
function fireUpTheCamera() {
Titanium.Media.showCamera({
success : function(event) {
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: ' + event.mediaType);
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
var imageView = Ti.UI.createImageView({
width : _window.width,
height : _window.height,
image : event.media,
autorotate: true
});
_window.add(imageView);
} else {
alert("got the wrong type back =" + event.mediaType);
}
},
cancel : function() {
},
error : function(error) {
// create alert
var a = Titanium.UI.createAlertDialog({
title : 'Camera'
});
// set message
if (error.code == Titanium.Media.NO_CAMERA) {
a.setMessage('Please run this test on device');
} else {
a.setMessage('Unexpected error: ' + error.code);
}
// show alert
a.show();
},
saveToPhotoGallery : true,
allowEditing : true,
mediaTypes : [Ti.Media.MEDIA_TYPE_VIDEO, Ti.Media.MEDIA_TYPE_PHOTO]
});
}
_window = Titanium.UI.createWindow({
backgroundColor: 'blue'
});
_window.addEventListener('open', function(e) {
fireUpTheCamera();
});
_window.open();
Here are my findings: 1. If you use the above sample code with the default Titanium app and follow the above steps, then the captured image will be portrait oriented on the blue window. This *is expected* since by default, only
Pragya, We can't control the Preview UI (retake or accept photo) and on iPhone this will rotate to portrait. On iPad the Preview UI is allowed to remain Landscape. Regarding the image view (blue background) we found that on iPhone with a default tiapp.xml, the UI would remain in portrait, but this was due to the available orientations set in the tiapp.xml. Adding the ability (via tiapp) to rotate the image view for iPhone would allow the UI to go landscape. In all cases the photo was shown in the correct orientation. Please let me know if you have concerns about what I say.
Hi Eric, Adding below code for ipod worked for me. Though, Preview UI was in portrait mode but that was not my concern. Earlier i assumed that adding orientation for iPhone will work for iPod as well.
Thanks