Phonegap: save base64 image to gallery

后端 未结 3 1079
甜味超标
甜味超标 2021-01-07 13:04

I just wanna save an image base64 and open it on gallery. I don\'t want to get pictures from gallery or take pictures.




        
3条回答
  •  长情又很酷
    2021-01-07 13:55

    To download base64 image on cordova, use this plugin which scanned your image into gallery also.

    https://github.com/agomezmoron/cordova-save-image-gallery

    function onDeviceReady() {
        var params = {data: base64String, prefix: 'myPrefix_', format: 'JPG', quality: 80, mediaScanner: true};
        window.imageSaver.saveBase64Image(params,
            function (filePath) {
              console.log('File saved on ' + filePath);
            },
            function (msg) {
              console.error(msg);
            }
          );
    }
    

提交回复
热议问题