芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/lot.mgaplay.com.br/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")).width=t.height=1,(a=t.getContext("2d")).drawImage(e,1-e.width,0),0===a.getImageData(0,0,1,1).data[3])},t.detectVerticalSquash=function(e,t){var a,n,r,i,c=document.createElement("canvas"),o=c.getContext("2d");for(c.width=1,c.height=t,o.drawImage(e,0,0),a=o.getImageData(0,0,1,t).data,n=0,r=t,i=t;i>n;)0===a[4*(i-1)+3]?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;return o&&s&&h&&a.crop?(n=s,r=h,s/h>d/g?f=(g-(l=h*d/s))/2:m=(d-(u=s*g/h))/2):(n=d,r=g,(i=Math.max((a.minWidth||n)/n,(a.minHeight||r)/r))>1&&(n=Math.ceil(n*i),r=Math.ceil(r*i)),1>(i=Math.min((s||n)/n,(h||r)/r))&&(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,0,0,n,r):c.getContext("2d").drawImage(e,m,f,u,l,0,0,n,r),c):(e.width=n,e.height=r,e)},t.createObjectURL=function(e){return!!a&&a.createObjectURL(e)},t.revokeObjectURL=function(e){return!!a&&a.revokeObjectURL(e)},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);