show image with blob javascript
function convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();
img.crossOrigin = 'Anonymous';
img.onload = function(){
var canvas = document.createElement('CANVAS'),
ctx = canvas.getContext('2d'), dataURL;
canvas.height = img.height;
canvas.width = img.width;
ctx.drawImage(img, 0, 0);
dataURL = canvas.toDataURL(outputFormat);
callback(dataURL);
canvas = null;
};
img.src = url;
}
convertImgToBase64URL('http://upload.wikimedia.org/wikipedia/commons/4/4a/Logo_2013_Google.png', function(base64Img){
alert('it works');
$('.output').find('img').attr('src', base64Img);
});
//function convertImgToBase64URL will convert the image into data urlConvertImgToBase64URL
Also in JavaScript:
- react duration picker
- image react native base64
- javascript how to split array into subarrays javascript
- mute everyone in call discord.js
- how to convert a number to a string in javascript
- javascript find the min in array of numbers
- jsx repeat
- array dia semana javascript
- how to use react memo hooks
- $(getJson) returning error
- handleClick react
- download a file nodejs
- remover ultimo character string javascript
- compare objects in javascript
- react native pm ERR! code EINTEGRITY
- node wait 10 seconds
- how to find index of max number in js
- how to check no internet connection in jquery mobile phone
- remove item jquery
- Material-ui Accessibility icon
- edit onclick event
- he href attribute is required for an anchor to be keyboard accessible
- react native hide scroll indicator
- jquery hide()