Выбор нескольких фотографий из галереи изображений устройства с помощью PhoneGap

Я смог построить тестовое приложение на основе примера camera.getPicture в документации PhoneGap. Оно позволяет мне сделать снимок или извлечь фотографию из галереи и поместить ее в дайвинг.

Однако я хочу иметь возможность выбрать несколько изображений из галереи и поместить каждое из них в отдельное погружение. Может ли кто-нибудь указать мне правильное направление, чтобы узнать, как это сделать?

Спасибо.

Вот JavaScript, который я использую:

var pictureSource;   // picture source
var destinationType; // sets the format of returned value 

// Wait for PhoneGap to connect with the device
document.addEventListener("deviceready",onDeviceReady,false);

// PhoneGap is ready to be used!
function onDeviceReady() {
    pictureSource=navigator.camera.PictureSourceType;
    destinationType=navigator.camera.DestinationType;
}

// Called when a photo is successfully retrieved
function onPhotoDataSuccess(imageData) {
  var largeImage = document.getElementById('largeImage');
  largeImage.style.display = 'block';
  largeImage.src = "data:image/jpeg;base64," + imageData;
}


function onPhotoURISuccess(imageURI) {
  var largeImage = document.getElementById('largeImage');
  largeImage.style.display = 'block';
  largeImage.src = imageURI;
}

// A button will call this function
function capturePhoto() {
    //add new div

    var newPhoto = document.createElement("div");
    newPhoto.id = "div";        
    newPhoto.className ="photo";
    newPhoto.innerHTML = "<img id='largeImage' src='' />";
    document.getElementById("photos").appendChild(newPhoto);


  // Take picture using device camera and retrieve image as base64-encoded string
  navigator.camera.getPicture(onPhotoDataSuccess, onPhotoURISuccess, onFail, { quality: 50 });
}

// A button will call this function
function getPhoto(source) {
    //add new div



  // Retrieve image file location from specified source
  navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, 
    destinationType: destinationType.FILE_URI,
    sourceType: source });
}


// Called if something bad happens.
function onFail(message) {
  alert('Failed because: ' + message);
6
задан Banjo Drill 6 September 2011 в 16:15
поделиться