[英]Phonegap camera.getPicture imageURI only temp in Cache folder, how can I get permanent imageSRC
[英]How would I get a File object from PhoneGap camera.getPicture?
这可能很简单,并且由PhoneGap的“Camera”插件,“File”插件或“File-Transfer”插件中的某些功能组合覆盖。 我了解用户可以选择一个文件:
navigator.camera.getPicture(function (fileURI) {
// *** need help here ***
}, function ()
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});
我也可以更改为destinationType: window.Camera.DestinationType.DATA_URL
如果这有所不同。
我在成功处理程序中的目标是获取File对象( https://developer.mozilla.org/en-US/docs/Web/API/File )。
这样的事情应该做到这一点。
navigator.camera.getPicture(function (fileURI) {
window.resolveLocalFileSystemURL(fileURI,
function(fileEntry){
alert("got image file entry: " + fileEntry.fullPath);
// fileEntry.file() should return a raw HTML File Object
},
function(){//error}
);
}, function (){
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});
window.resolveLocalFileSystemURI(fileURI, function(fileEntry) { /* your code here */ });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.