Answers for "imagen de url a base64"

1

imagen de url a base64

toDataURL('/images/Negativo_Leve.svg', function(dataUrl) {
	console.log('RESULT:', dataUrl)
});

function toDataURL(url, callback) {
	var xhr = new XMLHttpRequest();
	xhr.onload = function() {
		var reader = new FileReader();
		reader.onloadend = function() {
			callback(reader.result);
		}
		reader.readAsDataURL(xhr.response);
	};
	xhr.open('GET', url);
	xhr.responseType = 'blob';
	xhr.send();
}
Posted by: Guest on August-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language