How to display raw image data with html and javascript?

前端 未结 1 591
有刺的猬
有刺的猬 2021-02-19 23:24

I have an ajax application where the PHP side sends uncoded raw image data, coming from a camera, to the client javascript side.

I would like to display the image via ht

1条回答
  •  旧时难觅i
    2021-02-19 23:51

    Tried it for you =)

    http://jsfiddle.net/bYGum/

    All you have to do is make sure your string is base64 encoded and do the exact same thing you have already written:

    document.getElementById("image").src = jpgFile;
    

    0 讨论(0)
提交回复
热议问题