apicloud实现图片保存

function savePicture(url){
            var timestamp = new Date().getTime()
            api.download({
                url: url,
                savePath: 'fs://test'+timestamp+'.jpeg',
                report: true,
                cache: true,
                allowResume: true
            }, function(ret, err) {
                if(ret){
                    api.toast({
                        msg:'图片已保存到本地'
                    })
                }
                api.saveMediaToAlbum({
                    path: 'fs://test'+timestamp+'.jpeg'
                }, function(ret, err) {
                    
                });
            });
        }

你可能感兴趣的:(apicloud实现图片保存)