Compare commits

...

1 Commits

Author SHA1 Message Date
Jeffrey Warren
cbbfbff4bc bugfix version bump (#248) 2018-05-07 10:46:38 -04:00
4 changed files with 24 additions and 4 deletions

View File

@@ -46666,7 +46666,17 @@ function ReplaceImage(ref,selector,steps,options) {
xmlHTTP.responseType = 'arraybuffer';
xmlHTTP.onload = function(e) {
var arr = new Uint8Array(this.response);
var raw = String.fromCharCode.apply(null,arr);
// in chunks to avoid "RangeError: Maximum call stack exceeded"
// https://github.com/publiclab/image-sequencer/issues/241
// https://stackoverflow.com/a/20048852/1116657
var raw = '';
var i,j,subArray,chunk = 5000;
for (i=0,j=arr.length; i<j; i+=chunk) {
subArray = arr.subarray(i,i+chunk);
raw += String.fromCharCode.apply(null, subArray);
}
var base64 = btoa(raw);
var dataURL="data:image/"+ext+";base64," + base64;
make(dataURL);

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "image-sequencer",
"version": "1.4.0",
"version": "1.4.1",
"description": "A modular JavaScript image manipulation library modeled on a storyboard.",
"main": "src/ImageSequencer.js",
"scripts": {

View File

@@ -21,7 +21,17 @@ function ReplaceImage(ref,selector,steps,options) {
xmlHTTP.responseType = 'arraybuffer';
xmlHTTP.onload = function(e) {
var arr = new Uint8Array(this.response);
var raw = String.fromCharCode.apply(null,arr);
// in chunks to avoid "RangeError: Maximum call stack exceeded"
// https://github.com/publiclab/image-sequencer/issues/241
// https://stackoverflow.com/a/20048852/1116657
var raw = '';
var i,j,subArray,chunk = 5000;
for (i=0,j=arr.length; i<j; i+=chunk) {
subArray = arr.subarray(i,i+chunk);
raw += String.fromCharCode.apply(null, subArray);
}
var base64 = btoa(raw);
var dataURL="data:image/"+ext+";base64," + base64;
make(dataURL);