【发布时间】: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