【问题标题】:can't display Blob image on iis server无法在 iis 服务器上显示 Blob 图像
【发布时间】:2019-04-22 18:59:18
【问题描述】:

角度为 7 我需要使用 Blob 对象和 createObjectURL 显示来自数据库的个人资料图片 它适用于当地主人的心情 但在 iis 服务器上发布生产版本时不起作用 谁能帮我解决这个问题

我的语言代码

  this.usersService.prieveiewFileDB(this.AttachId).subscribe(Attach=>{
console.log(Attach)
  let file = new Blob([Attach], { type:"image"});   
  let unsafeImageUrl = URL.createObjectURL(file);      
  this.imageUrl = this.sanitizer.bypassSecurityTrustUrl(unsafeImageUrl);   
})  
});

HTML

<button mat-button [matMenuTriggerFor]="profile">
   <span class="img_prf">
    <img [src]="imageUrl" alt="image">
     </span>
     <span class="usr_name">{{userName}}</span>
   <i class="fas fa-caret-down"></i>
  </button>

【问题讨论】:

    标签: angular


    【解决方案1】:

    您是否检查了您的图像类型?示例类型:“image/png

    let file = new Blob([Attach], { type:"image/png"});  
    

     let file = new Blob([Attach], { type:"image/jpg"});  
    

    还要检查 IIS 中的 MIME 类型

    【讨论】:

      猜你喜欢
      • 2014-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-04
      • 1970-01-01
      • 2018-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多