芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/midiatech/web/dist/vendor/jquery-file-upload/js/load-image.min.js
(function(e){"use strict";var t=function(e,a,n){var r,i,c=document.createElement("img");if(c.onerror=a,c.onload=function(){!i||n&&n.noRevoke||t.revokeObjectURL(i),a&&a(t.scale(c,n))},t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e))r=i=t.createObjectURL(e),c._type=e.type;else{if("string"!=typeof e)return!1;r=e,n&&n.crossOrigin&&(c.crossOrigin=n.crossOrigin)}return r?(c.src=r,c):t.readFile(e,function(e){var t=e.target;t&&t.result?c.src=t.result:a&&a(e)})},a=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.detectSubsampling=function(e){var t,a;return e.width*e.height>1048576?(t=document.createElement("canvas"),t.width=t.height=1,a=t.getContext("2d"),a.drawImage(e,-e.width+1,0),0===a.getImageData(0,0,1,1).data[3]):!1},t.detectVerticalSquash=function(e,t){var a,n,r,i,c,o=document.createElement("canvas"),d=o.getContext("2d");for(o.width=1,o.height=t,d.drawImage(e,0,0),a=d.getImageData(0,0,1,t).data,n=0,r=t,i=t;i>n;)c=a[4*(i-1)+3],0===c?r=i:n=i,i=r+n>>1;return i/t||1},t.renderImageToCanvas=function(e,a,n,r,i,c,o,d,g,s){var h,u,l,m=e.getContext("2d"),f=document.createElement("canvas"),w=f.width=f.height=1024,v=f.getContext("2d");for(m.save(),t.detectSubsampling(a)&&(i/=2,c/=2),h=t.detectVerticalSquash(a,c),g=Math.ceil(w*g/i),s=Math.ceil(w*s/c/h),d=0,l=0;c>l;){for(o=0,u=0;i>u;)v.clearRect(0,0,w,w),v.drawImage(a,n,r,i,c,-u,-l,i,c),m.drawImage(f,0,0,w,w,o,d,g,s),u+=w,o+=g;l+=w,d+=s}m.restore()},t.scale=function(e,a){a=a||{};var n,r,i,c=document.createElement("canvas"),o=e.getContext||(a.canvas||a.crop)&&c.getContext,d=e.width,g=e.height,s=a.maxWidth,h=a.maxHeight,u=d,l=g,m=0,f=0,w=0,v=0;return o&&s&&h&&a.crop?(n=s,r=h,s/h>d/g?(l=h*d/s,f=(g-l)/2):(u=s*g/h,m=(d-u)/2)):(n=d,r=g,i=Math.max((a.minWidth||n)/n,(a.minHeight||r)/r),i>1&&(n=Math.ceil(n*i),r=Math.ceil(r*i)),i=Math.min((s||n)/n,(h||r)/r),1>i&&(n=Math.ceil(n*i),r=Math.ceil(r*i))),o?(c.width=n,c.height=r,"image/jpeg"===e._type?t.renderImageToCanvas(c,e,m,f,u,l,w,v,n,r):c.getContext("2d").drawImage(e,m,f,u,l,w,v,n,r),c):(e.width=n,e.height=r,e)},t.createObjectURL=function(e){return a?a.createObjectURL(e):!1},t.revokeObjectURL=function(e){return a?a.revokeObjectURL(e):!1},t.readFile=function(e,t){if(window.FileReader&&FileReader.prototype.readAsDataURL){var a=new FileReader;return a.onload=a.onerror=t,a.readAsDataURL(e),a}return!1},"function"==typeof define&&define.amd?define(function(){return t}):e.loadImage=t})(this);