JavaScript: image to dataurl converter similar to http://daturi.me/ but clientside conversion