2016-08-22 92 views
0

我们从图库中获取图像,并将图像名称保存到Sqlite中。图像在应用关闭时从tmp文件夹中删除

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; 
} 

我们将图片名保存到Sqlite后,我们重新加载了页面,然后从Sqlite中获取图片名称。我们加入到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; 
                  } 
} 

它的工作很好,但是当我们关闭应用程序,tmp文件夹的数据将会消失,因此我们无法显示图像。即使tmpfile也被删除,是否有替代方法来显示图像?

回答

相关问题