redid import-image and fix ExportBin fixes #899 (#900)

* redid import-image and fix ExportBin fixes #899

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* 3.0.1

* bypass import-image

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
Varun Gupta
2019-03-20 23:23:02 +05:30
committed by Jeffrey Warren
parent 21ff486618
commit cb53efbe21
10 changed files with 13171 additions and 13303 deletions

View File

@@ -14,13 +14,13 @@ function LoadImage(ref, name, src, main_callback) {
callback(datauri, step);
}
else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) {
require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){
require(src.match(/^(https?):\/\//i)[1]).get(src, function(res) {
var data = '';
var contentType = res.headers['content-type'];
res.setEncoding('base64');
res.on('data',function(chunk) {data += chunk;});
res.on('end',function() {
callback("data:"+contentType+";base64,"+data, step);
res.on('data', function(chunk) { data += chunk; });
res.on('end', function() {
callback("data:" + contentType + ";base64," + data, step);
});
});
}
@@ -32,10 +32,10 @@ function LoadImage(ref, name, src, main_callback) {
image.onload = function() {
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
context.drawImage(image,0,0);
datauri = canvas.toDataURL(ext);
context.drawImage(image, 0, 0);
datauri = canvas.toDataURL(ext);
callback(datauri, step);
}
}
image.src = src;
}
else {
@@ -52,7 +52,7 @@ function LoadImage(ref, name, src, main_callback) {
inBrowser: ref.options.inBrowser,
ui: ref.options.ui,
UI: ref.events,
output : ''
output: ''
};
@@ -69,7 +69,7 @@ function LoadImage(ref, name, src, main_callback) {
});
}
return loadImage(name,src);
return loadImage(name, src);
}
module.exports = LoadImage;