【问题标题】:The image not upload correctly, Angular 8 and ngx-image-compress图片未正确上传,Angular 8 和 ngx-image-compress
【发布时间】:2023-03-27 18:01:01
【问题描述】:

This is the problem

我需要先压缩图像才能上传到 Firebase 的存储中,我正在使用 ngx-image-compress。

图片是上传到 Firebase 的存储,但它看不到。

在我的代码中,我使用的是 ngx-image-compress 库的下一个方法(compressFile)

this.imageCompress.compressFile( event.target.result, 50, 50).then( result => {
  this.imagenComprimida = result;  
  this.guardarImagen(result); //This function call the Firestore method putString() to upload image b64
});

变量 imagenComprimida 是在 html 中显示它,但不在 Firestore 存储中。

我不明白为什么。

我也尝试使用下一个方法转换为文件,但它也不起作用。

let imageFile = new File([result], "any", { type: 'image/jpeg' });

希望你能帮助我。

【问题讨论】:

    标签: javascript compression firebase-storage


    【解决方案1】:

    解决了!!

    ngx-image-compress 库与 Firestore 存在问题。我不知道为什么。

    我发现 ng2-img-max 并且这个库运行没有问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-17
      • 1970-01-01
      • 1970-01-01
      • 2019-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多