Convert base64 string to blob. A file that uses a file loader is a blob with additional properties, so blob loading works the same way.
var file = dataURItoBlob(canString, 'image/png'); function dataURItoBlob(dataURI, type) {
UPDATE
To convert a base64 string to an image:
var image = new Image(), containerWidth = null, containerHeight = null; image.onload=function(){ containerWidth = image.width; containerHeight = image.height; } image.src = base64string;
Or save the base64 string locally as a file (this file is turned off, but I find where I implemented it):
function saveImage(base64string) { var imageData = base64string.split(',')[1]; var a = $("<a>").attr("href", "data:Application/base64," + imageData ) .attr("download","image.png") .appendTo("body"); a[0].click(); a.remove(); }
source share