phonegap / cordova select multiple photos

匿名 (未验证) 提交于 2019-12-03 01:00:01

问题:

Does anyone know if it's possible to select multiple photos from an album using phonegap/cordova?

It's fairly easy to create an app to select one photo using the documentation but it is not documented how to select multiple photos???

Maybe I need some plugin for it (iOS/Android)? Or a workaround? This problem is really a show stopper for me so a decent solution to this would be great.

回答1:

Currently the functionality is not available in the core API. There is an enhancement request open however. At this point your best bet would be to write a plugin.



回答2:

For multiple selection I have made use of file plugin which iterates through all the directories recursively and finds the image . It ignores the hidden file

var numDirs = 0; var numFiles = 0; var ImageFilePath = new Array();  function GetAllImageFromSD() {     window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);  }  function onFileSystemSuccess(fileSystem) {     fileSystem.root.getDirectory("/sdcard", { create: false, exclusive: false }, getDirSuccess, fail); }  function getDirSuccess(dirEntry) {     var directoryReader = dirEntry.createReader();      // Get a list of all the entries in the directory     directoryReader.readEntries(readerSuccess, fail); }   var readerTimeout = null, millisecondsBetweenReadSuccess = 1000;  function readerSuccess(entries) {     String.prototype.startsWith = function (str)     { return (this.match("^" + str) == str) }      var i = 0, len = entries.length;     for (; i 
"; for (var j = 0; j " var ChkId = "chk" + j; GalleryImageTag += ""; GalleryImageTag += ""; GalleryImageTag += ""; } $('#ImageContainer').html(''); $('#ImageContainer').append(GalleryImageTag); $('#GalleryView').popup("open"); numDirs = 0; numFiles = 0; ImageFilePath = []; console.log(GalleryImageTag); }

This code might take time to complete if is there is lot of image.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!