apicloud实现图片保存

2017-09-14  本文已影响0人  游荡的猫咪
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) {
                    
                });
            });
        }
上一篇 下一篇

猜你喜欢

热点阅读