captainz 发表于 2016-5-30 14:12:26

ionic 保存图片到手机相册的问题

请问下我的图片下载下来后为什么在手机相册里面看不到?代码如下。请大神指点。。。
       $ionicPlatform.ready(function(){
                options = {};
                url = "http://view.ionic.io/phones.png";
                var targetPath = cordova.file.dataDirectory + "a.jpg";
                var trustHosts = true;
                $cordovaFileTransfer.download(url, targetPath, options, trustHosts)
                  .then(function(entry) {
                        value = angular.toJson(entry.nativeURL);
                        $scope.imgFile = entry.toURL();
                        alert($scope.imgFile);
                        $scope.i2 =    entry.toInternalURL();
                        alert($scope.i2);
                  }, function(err) {
                        // Error
                        alert("error");
                  }, function (progress) {
                        $timeout(function () {
                            $scope.downloadProgress = (progress.loaded / progress.total) * 100;
                        })
                  });
            });

ionicwang 发表于 2016-5-30 22:21:04

你下载的目录是什么,看看手机项目到底有么有图片

你保存到qq的图片目录试试

还有就是可能你的手机相册么有更新,更新一下手机相册试试
页: [1]
查看完整版本: ionic 保存图片到手机相册的问题