Wed Dec 19 12:51:23 EST 2018

Set image data


img.src = "data:image/gif;base64,iVBORw0KGg..."

The post mentions imagedata.


I already have a way to deliver binary data over websocket.  Can this
just be dumped without encoding to base64?


Or just do this ArrayBuffer to base64 conversion in the browser?

Create a jpg image from ArrayBuffer data:

var arrayBufferView = new Uint8Array( this.response );
var blob = new Blob( [ arrayBufferView ], { type: "image/jpeg" } );
var urlCreator = window.URL || window.webkitURL;
var imageUrl = urlCreator.createObjectURL( blob );
var img = document.querySelector( "#photo" );
img.src = imageUrl;