How to convert a byte array into an image?

后端 未结 8 2095
一向
一向 2020-12-01 05:51

Using Javascript, I\'m making an AJAX call to a WCF service, and it is returning a byte array. How can I convert that to an image and display it on the web page?

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 06:06

    Using jQuery as an example:

    var myImage = $('< img src="data:image/jpg; base64," + bytesarray + "/>"');
    

提交回复
热议问题