I have a solution but its taking too much time. Here is my solution.
//------------ Image url to base64 -------------//
function convertImgToBase64(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 = this.height;
canvas.width = this.width;
ctx.drawImage(this, 0, 0);
dataURL = canvas.toDataURL(outputFormat);
callback(dataURL);
canvas = null;
};
img.src = url;
}
//------------ convert base64 into Blob -------------//
function dataURItoBlobImg(dataURI) {
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ia], {type:mimeString});
}
Now thing is first I have to convert image into base64 and after that I can convert into Blob, is there is any way I can directly convert into Blob from image URL.
Thanks.
I was trying to get the background color of an element using javascript: URL: https://mathemagiker.de/ Javascript: document.getElementById('angebot').style.backgroundColor Result: Nothing However ...
I was trying to get the background color of an element using javascript: URL: https://mathemagiker.de/ Javascript: document.getElementById('angebot').style.backgroundColor Result: Nothing However ...
How I can use selectize.js with remote source? I have followed this example: $('#select-repo').selectize({ valueField: 'url', labelField: 'name', searchField: 'name', create: false, ...
How I can use selectize.js with remote source? I have followed this example: $('#select-repo').selectize({ valueField: 'url', labelField: 'name', searchField: 'name', create: false, ...
i'm trying to inline edit an input this way, i wrote a clickOutside directive and it works fine but in my example when i click to edit editMode becomes true and immediately input is shown and ...
i'm trying to inline edit an input this way, i wrote a clickOutside directive and it works fine but in my example when i click to edit editMode becomes true and immediately input is shown and ...
I'm looking for same method like getElementsAtPosition(x,y) but instead of position I want to get all DOM for a given area (may be a rectangle). So it should look something like getAllElementsAtArea(...
I'm looking for same method like getElementsAtPosition(x,y) but instead of position I want to get all DOM for a given area (may be a rectangle). So it should look something like getAllElementsAtArea(...