javascript - Types of conversion of images -
i converting images base64 , sending them websocket.
using javacript:
var reader = new filereader(); reader.onload = (function(aimg){ return function(e){ aimg.src = e.target.result; imagemessage = aimg.src; }; }(image)) var ret = reader.readasdataurl(file);
in socket server string:
data:image/jpeg;base64,/9j/4aaqskzjrgabaqeayabgaad/4rfgrxhpzgaatu0akgaaaagacaeyaaiaaaauaaaiege7aaiaaaahaaaijkdgaamaaaabaamaaedjaamaaaabadiaaikyaaiaaaahaaailodpaaqaaaabaaaiujydaaeaaaaoaaarmoocaacaaagmaaaabgaaaaac6gaaaagaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa......
so as image size bigger, string longer. , socket crashing.
my question how convert image small , simple string.
Comments
Post a Comment