0
I have a "ERR_INVALID_URL" error and does not load the image. Does anyone know how to solve ? My html and Ts are like this.
//Aqui está vindo a url do servidor
let a = value.params["dataBuffer"];
//Aqui estou convertendo o base64 passando para
variavel imagePath q é do tipo any;
this.imagemPath = this.sanitizer.bypassSecurityTrustResourceUrl("data:image/png;base64, a");
----- No meu arquivo HTML -----------
<img [src]="imagemPath">
Which url is being passed?
– Herbert Junior
@Herbertjunior I’m using https://www.base64-image.de/ .. It generates a huge url of type: data:image/png;Base64,iVBORw0KGgoAAAANSUhEUgACDQAAAFwCAYAAABNBblg.....
– Dan100
And when you paste in the browser, you can see the image normally?
– Herbert Junior
Yes, I can see the image in the good browser.
– Dan100
@Herbertjunior No console shows this date:image/png;Base64 error, a:1 GET data:image/png;Base64, a net::ERR_INVALID_URL
– Dan100
Shouldn’t be:
this.sanitizer.bypassSecurityTrustResourceUrl('data:image/png;base64, ' + a);
? In your Voce code you are trying to use the a string as Base64.– Marcus Vinicius
@Herbertjunior Tested this way that you did here, now the url reaches the "a" but the same ERR_INVALID_URL error . Still not bringing the image. :(
– Dan100
Try using this tutorial http://www.manuelmeyer.net/2014/12/tooltip-decoding-base64-images-with-chrome-data-url/
– Herbert Junior
What is the use of this? this.sanitizer.bypassSecurityTrustResourceUrl
– rafaelmacedo