phonegap相机问题“失败,因为:”

时间:2012-05-31 08:02:38

标签: android eclipse cordova eclipse-plugin camera

我正在使用PhoneGap相机,我面临一个奇怪的问题。我在Eclipse AVD和实际的HTC Wildfire上从官方网站上运行了这个例子,但是因为我安装了AppLaud ADT,它停止了工作,现在我收到了消息

  

“失败原因:”

没有错误消息。

我尝试从scracth重新安装eclipse并再次复制该示例失败。

1 个答案:

答案 0 :(得分:0)

您可能尚未将图像数据发送到onSuccess方法。

function onPhotoDataSuccess(imageData) {

      var smallImage = document.getElementById('smallImage');

      // Unhide image elements
      //
      smallImage.style.display = 'block';

      // Show the captured photo
      // The inline CSS rules are used to resize the image
      //
      smallImage.src = "data:image/jpeg;base64," + imageData;
        alert('set image');
    }

navigator.camera.getPicture(onSuccess, onFail, { quality: 20,
        destinationType: destinationType.DATA_URL });

function onSuccess(imageURI) {
    var image = document.getElementById('myImage');
    image.src = imageURI;

}

function onFail(message) {
    alert('Failed because: ' + message);
}
相关问题