【问题标题】:Images downloaded from s3, how to save them从s3下载的图像,如何保存它们
【发布时间】:2018-04-12 16:59:33
【问题描述】:

从 s3 下载图像后,我在“正文”中得到了一堆位。以前,我将这些位编码为 base64 并直接在 <img> 标签中显示。

但现在,我想将它们保存到文件系统 (android/iOS) 中的“真实”文件 (.jpg/png) 中,然后给出 html(背景)标签的路径。

(会起作用吗?)

我还需要将我从 S3 获得的一堆位转换为 base64 然后保存还是有更直接的方法?

【问题讨论】:

    标签: html image ionic-framework amazon-s3 mobile-application


    【解决方案1】:
    You can use the plugin cordova-plugin-file for saving file  locally to your filesystem.
    
    Like this
    var url = url;
        var targetPath = cordova.file.externalDataDirectory + NAME;
        //alert(targetPath);
        var trustHosts = true;
        var options = {};
    
    $cordovaFileTransfer.download(url, targetPath, options, trustHosts)
    
    I think you can give the local file address to img src..
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-04-04
      • 2017-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-07
      • 1970-01-01
      相关资源
      最近更新 更多