ArrayBuffer as source (image tag) / Display image from Blob

Discussão em 'Angular' iniciado por guwluws, Abril 23, 2025.

  1. guwluws

    guwluws Guest

    I'm trying to set an arraybuffer as source of an image tag. It seems that I've got 2 problems. My console is logging:


    GET unsafe:data:image/jpg;base64, [object ArrayBuffer] net::ERR_UNKNOWN_URL_SCHEME
    ​

    so my question is:
    1. How do I convert my 'blob' to a string?
    (if necessary: 2. How to remove the unsafe flag?)

    html:

    <img src="data:image/jpg;base64, {{blob}}">


    ts (blob is transferred):

    export class ImgViewerComponent implements OnInit {

    @Input('blob') blob: ArrayBuffer;

    constructor() { }

    ngOnInit() {
    }

    }

    Continue reading...

Compartilhe esta Página