0

We are getting an image from the gallery and we saved the image name into Sqlite.

var options = {quality: 75,
              destinationType : Camera.DestinationType.FILE_URI,
             sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
             allowEdit: true,
             encodingType: Camera.EncodingType.JPEG,
             targetWidth: 300,
             targetHeight: 300,
             popoverOptions: CameraPopoverOptions,
             saveToPhotoAlbum: true
             };
$cordovaCamera.getPicture(options).then(function (imageData) {
$scope.ChooseImage = imageData;
}

After we saved image name into Sqlite, we reloaded the page, and then get the image name from Sqlite. We add into the cordova.file.tempDirectory:

var imageGetting = "select * from images_details where taskId='"+$scope.unquid+"'";
            $cordovaSQLite.execute(db, imageGetting).then(function(data) {
                                                           var GetAllImages = data.rows.length;
                                                          for(i=0;i<GetAllImages;i++){
                                                          debugger;
                                                          $scope.images.push(cordova.file.tempDirectory + data.rows.item(i).imageUrl);
                                                          debugger;
                                                          }
}

It's working fine but when we close the app, the tmp folder data will be gone, so we're unable to show the images. Is there any alternative for showing the image even if the tmpfile is deleted as well?

Blue
  • 22,608
  • 7
  • 62
  • 92
Pavan Alapati
  • 635
  • 2
  • 8
  • 21

1 Answers1

0

There are several other persistent/temporary directories to save the images in.

The File plugin is well documented and you should make your way through it.

File Plugin: Where to store

Also the file system layouts are mentioned in the documentation.

GOSCHEN
  • 454
  • 4
  • 16