如何从手机图片到远程XPage的图片? [英] How to get a picture from phonegap to a remote XPage?

查看:143
本文介绍了如何从手机图片到远程XPage的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iPad上建了一个Phonegap应用程序1.6版本
设置ulr到Domino服务器上的XPage

I've built an Phonegap App with version 1.6 on my iPad an set the ulr to an XPage on the Domino Server

现在我的问题:

当我在iPhone上拍照时,使用函数 takePicture >returnvalueis a String like this

When I take a picture on the iPhone and upload it to my XPage using the function takePicture the "returnvalue" is a String like this

data:image/jpeg;base64,file://localhost/var/mobile/Applications/C1ABCAD3-5F54-45AB-81B0-A242940B58CB/tmp/photo_001.jpg

有机会获取文件上传而不是字符串?

is there a chance to get the file uploaded and not the string?

这里是我使用的代码:

XSP.submitLatency = 300*1000;

function takePicture() {    
    navigator.camera.getPicture(displayPicture,
     showError,
      { quality: 50 }

      ); 

}

function displayPicture(data) {

alert("Hallo" );
    var imagePanel = document.getElementById('imagePanel');
    imagePanel.style.display = "";
    imagePanel.style.position = "absolute";
    imagePanel.style.top = "250px";
    imagePanel.style.left = "0px";




    alert("data:image/jpeg;base64," + data)
    document.getElementById('image').src = "data:image/jpeg;base64," + data;
    document.getElementById("#{javascript:getClientId('inputHidden1')}").value = "data:image/jpeg;base64," + data;

    document.getElementById("#{javascript:getClientId('button1')}").disabled = false;
}

function showError(fail) {
    alert(fail);
}


推荐答案

请要求 getPicture 方法返回FILE_URI而不是通过将destinationType指定为选项的一部分,而不是DATA_URL a>。获取URI后,您可以使用 FileTransfer.upload 以上传您的文件。

What you want to do is to ask the getPicture method to return a FILE_URI instead of the DATA_URL by specifying the destinationType as part of the options. Once you have the URI you can use FileTransfer.upload to upload your file.

这篇关于如何从手机图片到远程XPage的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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