Set base64 image to src

Hi, I’m trying to set a base64 image to the src, I have the value in Ionic Storage, but the image is not displayed.

Note: First I need to display an image located in my app resources, but when some data is processed I need to change the image to the new base64 image

this.storage.get("details").then(val => {
   this.user_img=  this._sanitizer.bypassSecurityTrustResourceUrl(val.user.img);
   console.log(this.user_img);
 });

But I’m still having this warning: WARNING: sanitizing unsafe URL value data:image/png;base64, (see http://g.co/ng/security#xss)

Solved, I used binding property and reloaded the server.

<img class="img" [src]="user_img" />
1 Like