2

私のアプリでは、PhoneGap を使用して写真を撮ろうとしましたが、失敗したメッセージが表示され、メッセージを Google で検索しても結果が得られません。写真を撮ることはできますが、メッセージが表示されます

ボタンにタブを付けたときの私のコード:

onBtnPhotoUmgebungTap: function(button, e, eOpts) {

  var pictureSource; 
 var destinationType; 

  console.log('here 1');

document.addEventListener("deviceready", onDeviceReady, false);


function onDeviceReady() {
    console.log('here 2');
    pictureSource = navigator.camera.PictureSourceType;
    destinationType = navigator.camera.DestinationType;
    navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
        quality : 50,
        destinationType : destinationType.DATA_URL
    })
}

 function onPhotoDataSuccess(imageData) {
    // Uncomment to view the base64 encoded image data
    var date = ""
    var d = new Date();
    date = "" + d.getDate() + "-" + (d.getMonth() + 1) + "-"
            + d.getFullYear();
    console.log('here 3');
            alert(date)
    //alert(imageData);  

    // Get image handle
    //
    var smallImage = document.getElementById('smallImage');
    // Unhide image elements
     console.log('here 4');
     console.log('smallimage:'+smallImage)
//
         smallImage.style.display = 'block';

   console.log('here 5');
    // Show the captured photo
    // The inline CSS rules are used to resize the image

    smallImage.src = "data:image/jpeg;base64," + imageData;
 console.log('here 6');
    alert("data:image/jpeg;base64," + imageData)
  console.log('here 7');
    //This part is for saving the capture photo
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);

        function gotFS(fileSystem) {
        alert("image/" + date + ".jpeg")
        fileSystem.root.getFile("image/" + date + ".jpeg", {
            create : true,
            exclusive : false
        }, gotFileEntry, fail);
    }
    function gotFileEntry(fileEntry) {
        fileEntry.createWriter(gotFileWriter, fail);
    }
    function gotFileWriter(writer) {
        var data = "data:image/jpeg;base64," + imageData;
        writer.write(data);

    }
    function fail(error) {
        alert("error")
        console.log(error.code);
    }




  }
    function onPhotoURISuccess(imageURI) {
    // Uncomment to view the image file URI 
    // console.log(imageURI);

    // Get image handle
    var largeImage = document.getElementById('largeImage');
    // Unhide image elements
   // largeImage.style.display = 'block';
  console.log('here 9');
    // Show the captured photo
    // The inline CSS rules are used to resize the image
    //
    largeImage.src = imageURI;
}

 function onFail(message) {
alert('Failed because: ' + message);
 }},

そしてここに失敗したメッセージ:

processMessage が失敗しました: メッセージ: S01 Camera1533883342 + URI

誰かが私を助けてくれることを願っています

挨拶をありがとう

4

0 に答える 0