手机峡相机方向 [英] Phone Gap camera orientation

查看:153
本文介绍了手机峡相机方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用电话差距版本开发的应用程序的 0.9.3

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>

请帮我在这...

推荐答案

base64格式返回一个图像时(所有的EXIF数据已被剥离)。照片显示方向不存储

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.

这篇关于手机峡相机方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆