I can only find information in their docs about the Accelerometer for returning device orientation. Is there anyway phonegap can return what way the device was being held when a picture was taken? To use the camera, I do this:
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
destinationType: destinationType.DATA_URL });
}
When it returns successful, it does this.
function onPhotoDataSuccess(imageData) {
var baseImg = imageData;
$('#uploadPreUpImgSwapHtml').html('<img src="data:image/jpeg;base64,'+ baseImg +'" style="max-width:100%; width:auto; max-height:300px; height:auto;" / >');
$('#uploadPreBaseDataSwapHtml').html('<input type="hidden" id="chosenPictureData" value="'+ baseImg +'" />');
$('#uploadPictureBtnHideHtml').fadeIn();
}
Is there a callback to the success that returns what way the device was being held while the picture was taken so I can send it to my upload file and rotate the picture correctly?
I can only find information in their docs about the Accelerometer for returning device orientation. Is there anyway phonegap can return what way the device was being held when a picture was taken? To use the camera, I do this:
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
destinationType: destinationType.DATA_URL });
}
When it returns successful, it does this.
function onPhotoDataSuccess(imageData) {
var baseImg = imageData;
$('#uploadPreUpImgSwapHtml').html('<img src="data:image/jpeg;base64,'+ baseImg +'" style="max-width:100%; width:auto; max-height:300px; height:auto;" / >');
$('#uploadPreBaseDataSwapHtml').html('<input type="hidden" id="chosenPictureData" value="'+ baseImg +'" />');
$('#uploadPictureBtnHideHtml').fadeIn();
}
Is there a callback to the success that returns what way the device was being held while the picture was taken so I can send it to my upload file and rotate the picture correctly?
Share Improve this question asked Oct 3, 2012 at 2:01 user1053263user1053263 7422 gold badges16 silver badges33 bronze badges1 Answer
Reset to default 23To make your life easier you can just call:
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
destinationType: destinationType.FILE_URI,
correctOrientation: true });
then you'll get a file that is rotated properly.