Browse Source

Allow passing src to load image bypassing fileReader

pull/6/head
Dr. Kibitz 11 years ago
parent
commit
40f531415b
  1. 18
      resemble.js

18
resemble.js

@ -77,12 +77,8 @@ URL: https://github.com/Huddle/Resemble.js
}
function loadImageData( fileData, callback ){
var hiddenImage = new Image();
var fileReader = new FileReader();
fileReader.onload = function (event) {
hiddenImage.src = event.target.result;
};
var fileReader,
hiddenImage = new Image();
hiddenImage.onload = function() {
@ -101,7 +97,15 @@ URL: https://github.com/Huddle/Resemble.js
callback(imageData, width, height);
};
fileReader.readAsDataURL(fileData);
if (typeof fileData === 'string') {
hiddenImage.src = fileData;
} else {
fileReader = new FileReader();
fileReader.onload = function (event) {
hiddenImage.src = event.target.result;
};
fileReader.readAsDataURL(fileData);
}
}
function isColorSimilar(a, b, color){

Loading…
Cancel
Save