reader.onload = (function (img1)
{
return function(event) {
img1.attr("src", event.target.result);
var d=img.attr('src');
console.log(d);
a= atob(d.substr( "data:image/jpeg;base64,".length ));
};
}
)( img)
reader.onerror = function(event) {
alert("I AM ERROR: " + event.target.error.code);
};
img1.attr("src", event.target.result);
var d = img.attr('src');