【问题标题】:images deleted form tmp folder when app closed应用程序关闭时从 tmp 文件夹中删除的图像
【发布时间】:2016-08-22 12:52:52
【问题描述】:

我们正在从图库中获取图像,并将图像名称保存到 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;
}

我们将图片名称保存到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也被删除了,有没有其他方法可以显示图像?

【问题讨论】:

    标签: javascript ios cordova ngcordova ios-camera


    【解决方案1】:

    还有其他几个持久/临时目录可以保存图像。

    File 插件有很好的文档记录,您应该通过它。

    File Plugin: Where to store

    文档中还提到了file system layouts

    【讨论】:

      猜你喜欢
      • 2015-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-05
      相关资源
      最近更新 更多