I have developed an app using Phone Gap version 0.9.3...
When I open camera in my app ,it always opens in landscape mode and, on capture, the image is returned in landscape format...
How can I change the mode of camera to portrait
navigator.camera.getPicture(onsuccess, fail, {quality: 45,destinationType : Camera.DestinationType.DATA_URL, sourceType: src},img_id);
function onsuccess(imageData) {
localStorage.setItem("image_captured","Yes");
$('#'+imgID).attr('src', 'data:image/jpeg;base64,' + imageData);
$("#"+imgID+"_IMG").attr('src', 'data:image/jpeg;base64,' + imageData);
}
In manifest i had mention:
<activity android:name="com.android.camera.Camera"
android:screenOrientation="portrait">
</activity>
Please help me in this...
Try this : correctOrientation: true
function getPhoto(source) {
navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 30,
destinationType: destinationType.FILE_URI,
sourceType: source,
correctOrientation: true });
}
photo orientation is not stored when returning an image in base64 format (all EXIF data is stripped).
You should use the accelerometer or screen orientation to "know" if the image was taken in portrait or landscape and then display it accordingly.
The "correctOrientation" parameter works fine for me - but only if you're also using the "targetWidth" and "targetHeight" parameters (e.g. set them to "800"). It seems that some devices may not have enough memory to rotate a full resolution picture.
Update: Here's a nice article with useful information about memory, scaling and EXIF issues with the Phonegap Camera code: http://simonmacdonald.blogspot.ca/2012/07/change-to-camera-code-in-phonegap-190.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With