我正在使用 Phonegap 检索相机图片,然后将其输出到 HTML5 画布上。
如果我使用后置摄像头,一切都很好,但如果我使用前置摄像头,图像会上下颠倒。
有没有人遇到过这个问题?关于为什么会发生这种情况的任何想法?
有什么办法可以查出是用哪个相机拍照的吗?
以下是我的代码:
//take picture on click
$("#camera").click(function(){
//Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });
})
// Called when a photo is successfully retrieved in base64 format.
// It draws the photo on the canvas.
function onPhotoDataSuccess(imageData) {
var imageObj = new Image();
imageObj.onload = function(){
drawImage(cbook, this);
};
imageObj.src = imageData;
}
谢谢。