Loading src/jp4-canvas/jquery-jp4.js +58 −43 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ ip: "", ip: "", port: "", port: "", image: "test.jp4", image: "test.jp4", fromhtmlinput: false, refresh: false, refresh: false, mosaic: [["Gr","R"],["B" ,"Gb"]], mosaic: [["Gr","R"],["B" ,"Gb"]], fast: false, fast: false, Loading Loading @@ -89,18 +90,28 @@ elem.append(cnv_working); elem.append(cnv_working); elem.append(cnv_display); elem.append(cnv_display); get_image(); if (DEBUG){ //end TX = Date.now(); T0 = Date.now(); } function get_image(){ if (settings.fromhtmlinput){ /* * if image is being loaded from <input type='file'> * make sure the image data starts with: "data:image/jpeg;base64," * EXIF.js does not like empty data type: "data:;base64," */ process_image(settings.image); }else{ send_request(); } //end var canvas = cnv_working; function send_request(){ //reset format var rq = ""; IMAGE_FORMAT = "JPEG"; var http = new XMLHttpRequest(); var http = new XMLHttpRequest(); var rq = ""; if (settings.port!=""&&settings.ip!=""){ if (settings.port!=""&&settings.ip!=""){ rq = "get-image.php?ip="+settings.ip+"&port="+settings.port+"&rel=bimg&ts="+Date.now(); rq = "get-image.php?ip="+settings.ip+"&port="+settings.port+"&rel=bimg&ts="+Date.now(); Loading @@ -111,12 +122,6 @@ } } http.open("GET", rq, true); http.open("GET", rq, true); if (DEBUG){ TX = Date.now(); T0 = Date.now(); } http.responseType = "blob"; http.responseType = "blob"; http.onload = function(e) { http.onload = function(e) { Loading @@ -126,6 +131,20 @@ } } if (this.status === 200) { if (this.status === 200) { var imgdata = URL.createObjectURL(http.response); process_image(imgdata); } }; http.send(); } function process_image(imagedata){ var canvas = cnv_working; //reset format IMAGE_FORMAT = "JPEG"; var heavyImage = new Image(); var heavyImage = new Image(); Loading Loading @@ -167,11 +186,7 @@ }); }); }; }; heavyImage.src = URL.createObjectURL(http.response); heavyImage.src = imagedata; } }; http.send(); } } Loading Loading
src/jp4-canvas/jquery-jp4.js +58 −43 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ ip: "", ip: "", port: "", port: "", image: "test.jp4", image: "test.jp4", fromhtmlinput: false, refresh: false, refresh: false, mosaic: [["Gr","R"],["B" ,"Gb"]], mosaic: [["Gr","R"],["B" ,"Gb"]], fast: false, fast: false, Loading Loading @@ -89,18 +90,28 @@ elem.append(cnv_working); elem.append(cnv_working); elem.append(cnv_display); elem.append(cnv_display); get_image(); if (DEBUG){ //end TX = Date.now(); T0 = Date.now(); } function get_image(){ if (settings.fromhtmlinput){ /* * if image is being loaded from <input type='file'> * make sure the image data starts with: "data:image/jpeg;base64," * EXIF.js does not like empty data type: "data:;base64," */ process_image(settings.image); }else{ send_request(); } //end var canvas = cnv_working; function send_request(){ //reset format var rq = ""; IMAGE_FORMAT = "JPEG"; var http = new XMLHttpRequest(); var http = new XMLHttpRequest(); var rq = ""; if (settings.port!=""&&settings.ip!=""){ if (settings.port!=""&&settings.ip!=""){ rq = "get-image.php?ip="+settings.ip+"&port="+settings.port+"&rel=bimg&ts="+Date.now(); rq = "get-image.php?ip="+settings.ip+"&port="+settings.port+"&rel=bimg&ts="+Date.now(); Loading @@ -111,12 +122,6 @@ } } http.open("GET", rq, true); http.open("GET", rq, true); if (DEBUG){ TX = Date.now(); T0 = Date.now(); } http.responseType = "blob"; http.responseType = "blob"; http.onload = function(e) { http.onload = function(e) { Loading @@ -126,6 +131,20 @@ } } if (this.status === 200) { if (this.status === 200) { var imgdata = URL.createObjectURL(http.response); process_image(imgdata); } }; http.send(); } function process_image(imagedata){ var canvas = cnv_working; //reset format IMAGE_FORMAT = "JPEG"; var heavyImage = new Image(); var heavyImage = new Image(); Loading Loading @@ -167,11 +186,7 @@ }); }); }; }; heavyImage.src = URL.createObjectURL(http.response); heavyImage.src = imagedata; } }; http.send(); } } Loading