Want to store images after capturing from camera and selecting in an array and display it


#1

Below is my code for storing images after selecting from gallery and after selecting in an array but it doesnt work . help me :frowning:

$scope.pictureUrl = “http://placehold.it/100x100”;
$scope.pictureUrl2 = “http://placehold.it/100x100”;

$scope.takePicture = function () {
var options = {
  destinationType: Camera.DestinationType.DATA_URL,
  sourceType: Camera.PictureSourceType.CAMERA,
  encodingType: Camera.EncodingType.JPEG
};
$cordovaCamera.getPicture(options).then(function(imageData) {
    //console.log('camera data: ' + angular.toJSON(imageData));
    $scope.imgdata = imageData;
    var savedImages = [];
    savedImages.push(imageData);
    for (var i = 0; i < savedImages.length; i++)
    {
  $scope.pictureUrl = 'data:image/jpeg;base64,' + savedImages[i];
  $scope.pictureUrl2 = 'data:image/jpeg;base64,' + savedImages[i+1];
}//$scope.blobImg = dataURItoBlob($scope.pictureUrl);
  window.alert("Picture Captured .. !!");
}, function (err) {
  //console.log('camera error: ' + angular.toJSON(imageData));
  window.alert('Error: ' + err.message);
});

};

$scope.takePhoto = function () {
var options = {
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
encodingType: Camera.EncodingType.JPEG
};
$cordovaCamera.getPicture(options).then(function (imageData) {
$scope.imgdata=imageData;
$scope.pictureUrl = ‘data:image/jpeg;base64,’ + imageData;
$scope.pictureUrl2= ‘data:image/jpeg;base64,’ + imageData[1];
// $scope.pictureUrl2= ‘data:image/jpeg;base64,’ + imageData[i+1];
//$scope.blobImg = dataURItoBlob($scope.pictureUrl);
window.alert(“Picture Captured … !!”);
}, function (err) {
window.alert(‘Error:’ + err.message);
});
};