diff --git a/wire/modules/Inputfield/InputfieldImage/PWImageResizer.js b/wire/modules/Inputfield/InputfieldImage/PWImageResizer.js index 1fe96e65..40061242 100644 --- a/wire/modules/Inputfield/InputfieldImage/PWImageResizer.js +++ b/wire/modules/Inputfield/InputfieldImage/PWImageResizer.js @@ -112,7 +112,9 @@ PWImageResizer.prototype.resize = function(file, completionCallback) { This.consoleLog('detecting JPEG image orientation...'); if((typeof EXIF.getData === "function") && (typeof EXIF.getTag === "function")) { + This.consoleLog('EXIF.getData starting'); EXIF.getData(img, function() { + This.consoleLog('EXIF.getData done, orientation:'); var orientation = EXIF.getTag(this, "Orientation"); This.consoleLog('image orientation from EXIF tag: ' + orientation); This.scaleImage(img, orientation, completionCallback); diff --git a/wire/modules/Inputfield/InputfieldImage/PWImageResizer.min.js b/wire/modules/Inputfield/InputfieldImage/PWImageResizer.min.js index 61a0d7f1..3115045b 100644 --- a/wire/modules/Inputfield/InputfieldImage/PWImageResizer.min.js +++ b/wire/modules/Inputfield/InputfieldImage/PWImageResizer.min.js @@ -1 +1 @@ -var PWImageResizer=function(a){this.setConfig(a)};PWImageResizer.prototype.resize=function(c,d){var b=document.createElement("img");this.currentFile=c;var a=new FileReader();var e=this;var f=c.type.toString();a.onload=function(g){b.src=g.target.result;b.onload=function(){if(!e.needsResize(b,f)){d(false);return}if(f=="image/jpeg"&&e.config.autoRotate){e.consoleLog("detecting JPEG image orientation...");if((typeof EXIF.getData==="function")&&(typeof EXIF.getTag==="function")){EXIF.getData(b,function(){var h=EXIF.getTag(this,"Orientation");e.consoleLog("image orientation from EXIF tag: "+h);e.scaleImage(b,h,d)})}else{e.consoleLog("can't read EXIF data, the Exif.js library not found");e.scaleImage(b,0,d)}}else{e.scaleImage(b,0,d)}}};a.readAsDataURL(c)};PWImageResizer.prototype.needsResize=function(a,d){var c=false;var b="n/a";if(d!="image/jpeg"&&d!="image/png"&&d!="image/gif"){b="unsupported image content-type: "+d}else{if(this.config.scaleRatio>0){c=true;b="scaleRatio specified"}else{if(this.config.maxWidth>0||this.config.maxHeight>0){if(this.config.maxWidth>0&&a.width>this.config.maxWidth){c=true}if(this.config.maxHeight>0&&a.height>this.config.maxHeight){c=true}b=c?"dimensions exceed max allowed":"dimensions do not require resize"}}}if(!c&&this.config.maxSize>0){if(this.config.maxSize<(a.width*a.height)/1000000){c=true}b=(c?"megapixels exceeds ":"megapixels below ")+this.config.maxSize}if(this.config.debug){this.consoleLog("needsResize="+(c?"Yes":"No")+" ("+b+")")}return c};PWImageResizer.prototype.drawImage=function(d,f,j,i,c,k,b,g,e,a){d.save();if(typeof c==="undefined"){c=f.width}if(typeof k==="undefined"){k=f.height}if(typeof a==="undefined"){a=false}if(a){j-=c/2;i-=k/2}d.translate(j+c/2,i+k/2);var h=2*Math.PI-b*Math.PI/180;d.rotate(h);if(g){flipScale=-1}else{flipScale=1}if(e){flopScale=-1}else{flopScale=1}d.scale(flipScale,flopScale);d.drawImage(f,-c/2,-k/2,c,k);d.restore()};PWImageResizer.prototype.scaleImage=function(i,c,l){var d=document.createElement("canvas");d.width=i.width;d.height=i.height;var p=d.getContext("2d");p.save();var b=d.width;var f=d.style.width;var o=d.height;var e=d.style.height;if(typeof c==="undefined"){c=1}if(c){if(c>4){d.width=o;d.style.width=e;d.height=b;d.style.height=f}switch(c){case 2:p.translate(b,0);p.scale(-1,1);break;case 3:p.translate(b,o);p.rotate(Math.PI);break;case 4:p.translate(0,o);p.scale(1,-1);break;case 5:p.rotate(0.5*Math.PI);p.scale(1,-1);break;case 6:p.rotate(0.5*Math.PI);p.translate(0,-o);break;case 7:p.rotate(0.5*Math.PI);p.translate(b,-o);p.scale(-1,1);break;case 8:p.rotate(-0.5*Math.PI);p.translate(-b,0);break}}p.drawImage(i,0,0);p.restore();var k=d.width/d.height;var g=0;var h="";if(this.config.maxWidth>0||this.config.maxHeight>0){g=Math.min(this.config.maxWidth,k*this.config.maxHeight);h="max width/height of "+this.config.maxWidth+"x"+this.config.maxHeight}if(this.config.maxSize>0&&(this.config.maxSize<(d.width*d.height)/1000000)){var n=Math.floor(Math.sqrt(this.config.maxSize*k)*1000);g=g>0?Math.min(g,n):n;if(n===g){h="max megapixels of "+this.config.maxSize}}if(this.config.scaleRatio){var j=Math.floor(this.config.scaleRatio*d.width);g=g>0?Math.min(g,j):j;if(j==g){h="scale ratio of "+this.config.scaleRatio}}if(g<=0){this.consoleLog("image size is too small to resize");l(false);return}if(this.config.debug){this.consoleLog("original image size: "+d.width+"x"+d.height+" px");this.consoleLog("scaled image size: "+g+"x"+Math.floor(g/k)+" px via "+h)}while(d.width>=(2*g)){d=this.getHalfScaleCanvas(d)}if(d.width>g){d=this.scaleCanvasWithAlgorithm(d,g)}var m=this.config.quality;if(this.currentFile.type!="image/jpeg"){m=1}var a=d.toDataURL(this.currentFile.type,m);if(typeof this.config.onScale==="function"){this.config.onScale(a)}l(this.imageDataToBlob(a))};PWImageResizer.prototype.imageDataToBlob=function(h){var f=";base64,";if(h.indexOf(f)==-1){var e=h.split(",");var g=e[0].split(":")[1];var a=e[1];return new Blob([a],{type:g})}var e=h.split(f);var g=e[0].split(":")[1];var a=window.atob(e[1]);var d=a.length;var c=new Uint8Array(d);for(var b=0;b(y.height-1)?(y.height-1):Math.ceil(p));for(o=0;o(y.width-1)?(y.width-1):Math.ceil(f));e=(o+u.width*q)*4;n=(w+y.width*d)*4;C=(t+y.width*d)*4;m=(w+y.width*c)*4;B=(t+y.width*c)*4;k=f-w;h=p-d;l=z(y.data[n],y.data[C],y.data[m],y.data[B],k,h);u.data[e]=l;s=z(y.data[n+1],y.data[C+1],y.data[m+1],y.data[B+1],k,h);u.data[e+1]=s;v=z(y.data[n+2],y.data[C+2],y.data[m+2],y.data[B+2],k,h);u.data[e+2]=v;x=z(y.data[n+3],y.data[C+3],y.data[m+3],y.data[B+3],k,h);u.data[e+3]=x}}};PWImageResizer.prototype.setConfig=function(a){this.config=a;this.config.debug=this.config.debug||false;if(typeof a.quality=="undefined"){a.quality=1}if(a.quality<0.1){a.quality=0.1}if(a.quality>1){a.quality=1}this.config.quality=a.quality;if((!this.config.maxWidth)||(this.config.maxWidth<0)){this.config.maxWidth=0}if((!this.config.maxHeight)||(this.config.maxHeight<0)){this.config.maxHeight=0}if((!this.config.maxSize)||(this.config.maxSize<0)){this.config.maxSize=null}if((!this.config.scaleRatio)||(this.config.scaleRatio<=0)||(this.config.scaleRatio>=1)){this.config.scaleRatio=null}this.config.autoRotate=true;if(typeof a.autoRotate==="boolean"){this.config.autoRotate=a.autoRotate}if(this.config.maxWidth&&!this.config.maxHeight){this.config.maxHeight=this.config.maxWidth}else{if(this.config.maxHeight&&!this.config.maxWidth){this.config.maxWidth=this.config.maxHeight}else{if(!this.config.maxWidth&&!this.config.maxHeight){}}}};PWImageResizer.prototype.consoleLog=function(a){if(this.config.debug){console.log("PWImageResizer: "+a)}}; \ No newline at end of file +var PWImageResizer=function(a){this.setConfig(a)};PWImageResizer.prototype.resize=function(c,d){var b=document.createElement("img");this.currentFile=c;var a=new FileReader();var e=this;var f=c.type.toString();a.onload=function(g){b.src=g.target.result;b.onload=function(){if(!e.needsResize(b,f)){d(false);return}if(f=="image/jpeg"&&e.config.autoRotate){e.consoleLog("detecting JPEG image orientation...");if((typeof EXIF.getData==="function")&&(typeof EXIF.getTag==="function")){e.consoleLog("EXIF.getData starting");EXIF.getData(b,function(){e.consoleLog("EXIF.getData done, orientation:");var h=EXIF.getTag(this,"Orientation");e.consoleLog("image orientation from EXIF tag: "+h);e.scaleImage(b,h,d)})}else{e.consoleLog("can't read EXIF data, the Exif.js library not found");e.scaleImage(b,0,d)}}else{e.scaleImage(b,0,d)}}};a.readAsDataURL(c)};PWImageResizer.prototype.needsResize=function(a,d){var c=false;var b="n/a";if(d!="image/jpeg"&&d!="image/png"&&d!="image/gif"){b="unsupported image content-type: "+d}else{if(this.config.scaleRatio>0){c=true;b="scaleRatio specified"}else{if(this.config.maxWidth>0||this.config.maxHeight>0){if(this.config.maxWidth>0&&a.width>this.config.maxWidth){c=true}if(this.config.maxHeight>0&&a.height>this.config.maxHeight){c=true}b=c?"dimensions exceed max allowed":"dimensions do not require resize"}}}if(!c&&this.config.maxSize>0){if(this.config.maxSize<(a.width*a.height)/1000000){c=true}b=(c?"megapixels exceeds ":"megapixels below ")+this.config.maxSize}if(this.config.debug){this.consoleLog("needsResize="+(c?"Yes":"No")+" ("+b+")")}return c};PWImageResizer.prototype.drawImage=function(d,f,j,i,c,k,b,g,e,a){d.save();if(typeof c==="undefined"){c=f.width}if(typeof k==="undefined"){k=f.height}if(typeof a==="undefined"){a=false}if(a){j-=c/2;i-=k/2}d.translate(j+c/2,i+k/2);var h=2*Math.PI-b*Math.PI/180;d.rotate(h);if(g){flipScale=-1}else{flipScale=1}if(e){flopScale=-1}else{flopScale=1}d.scale(flipScale,flopScale);d.drawImage(f,-c/2,-k/2,c,k);d.restore()};PWImageResizer.prototype.scaleImage=function(i,c,l){var d=document.createElement("canvas");d.width=i.width;d.height=i.height;var p=d.getContext("2d");p.save();var b=d.width;var f=d.style.width;var o=d.height;var e=d.style.height;if(typeof c==="undefined"){c=1}if(c){if(c>4){d.width=o;d.style.width=e;d.height=b;d.style.height=f}switch(c){case 2:p.translate(b,0);p.scale(-1,1);break;case 3:p.translate(b,o);p.rotate(Math.PI);break;case 4:p.translate(0,o);p.scale(1,-1);break;case 5:p.rotate(0.5*Math.PI);p.scale(1,-1);break;case 6:p.rotate(0.5*Math.PI);p.translate(0,-o);break;case 7:p.rotate(0.5*Math.PI);p.translate(b,-o);p.scale(-1,1);break;case 8:p.rotate(-0.5*Math.PI);p.translate(-b,0);break}}p.drawImage(i,0,0);p.restore();var k=d.width/d.height;var g=0;var h="";if(this.config.maxWidth>0||this.config.maxHeight>0){g=Math.min(this.config.maxWidth,k*this.config.maxHeight);h="max width/height of "+this.config.maxWidth+"x"+this.config.maxHeight}if(this.config.maxSize>0&&(this.config.maxSize<(d.width*d.height)/1000000)){var n=Math.floor(Math.sqrt(this.config.maxSize*k)*1000);g=g>0?Math.min(g,n):n;if(n===g){h="max megapixels of "+this.config.maxSize}}if(this.config.scaleRatio){var j=Math.floor(this.config.scaleRatio*d.width);g=g>0?Math.min(g,j):j;if(j==g){h="scale ratio of "+this.config.scaleRatio}}if(g<=0){this.consoleLog("image size is too small to resize");l(false);return}if(this.config.debug){this.consoleLog("original image size: "+d.width+"x"+d.height+" px");this.consoleLog("scaled image size: "+g+"x"+Math.floor(g/k)+" px via "+h)}while(d.width>=(2*g)){d=this.getHalfScaleCanvas(d)}if(d.width>g){d=this.scaleCanvasWithAlgorithm(d,g)}var m=this.config.quality;if(this.currentFile.type!="image/jpeg"){m=1}var a=d.toDataURL(this.currentFile.type,m);if(typeof this.config.onScale==="function"){this.config.onScale(a)}l(this.imageDataToBlob(a))};PWImageResizer.prototype.imageDataToBlob=function(h){var f=";base64,";if(h.indexOf(f)==-1){var e=h.split(",");var g=e[0].split(":")[1];var a=e[1];return new Blob([a],{type:g})}var e=h.split(f);var g=e[0].split(":")[1];var a=window.atob(e[1]);var d=a.length;var c=new Uint8Array(d);for(var b=0;b(y.height-1)?(y.height-1):Math.ceil(p));for(o=0;o(y.width-1)?(y.width-1):Math.ceil(f));e=(o+u.width*q)*4;n=(w+y.width*d)*4;C=(t+y.width*d)*4;m=(w+y.width*c)*4;B=(t+y.width*c)*4;k=f-w;h=p-d;l=z(y.data[n],y.data[C],y.data[m],y.data[B],k,h);u.data[e]=l;s=z(y.data[n+1],y.data[C+1],y.data[m+1],y.data[B+1],k,h);u.data[e+1]=s;v=z(y.data[n+2],y.data[C+2],y.data[m+2],y.data[B+2],k,h);u.data[e+2]=v;x=z(y.data[n+3],y.data[C+3],y.data[m+3],y.data[B+3],k,h);u.data[e+3]=x}}};PWImageResizer.prototype.setConfig=function(a){this.config=a;this.config.debug=this.config.debug||false;if(typeof a.quality=="undefined"){a.quality=1}if(a.quality<0.1){a.quality=0.1}if(a.quality>1){a.quality=1}this.config.quality=a.quality;if((!this.config.maxWidth)||(this.config.maxWidth<0)){this.config.maxWidth=0}if((!this.config.maxHeight)||(this.config.maxHeight<0)){this.config.maxHeight=0}if((!this.config.maxSize)||(this.config.maxSize<0)){this.config.maxSize=null}if((!this.config.scaleRatio)||(this.config.scaleRatio<=0)||(this.config.scaleRatio>=1)){this.config.scaleRatio=null}this.config.autoRotate=true;if(typeof a.autoRotate==="boolean"){this.config.autoRotate=a.autoRotate}if(this.config.maxWidth&&!this.config.maxHeight){this.config.maxHeight=this.config.maxWidth}else{if(this.config.maxHeight&&!this.config.maxWidth){this.config.maxWidth=this.config.maxHeight}else{if(!this.config.maxWidth&&!this.config.maxHeight){}}}};PWImageResizer.prototype.consoleLog=function(a){if(this.config.debug){console.log("PWImageResizer: "+a)}}; \ No newline at end of file diff --git a/wire/modules/Inputfield/InputfieldImage/exif.js b/wire/modules/Inputfield/InputfieldImage/exif.js index f09b72a8..6eac8896 100644 --- a/wire/modules/Inputfield/InputfieldImage/exif.js +++ b/wire/modules/Inputfield/InputfieldImage/exif.js @@ -984,10 +984,16 @@ } EXIF.getData = function(img, callback) { + if (((self.Image && img instanceof self.Image) + || (self.HTMLImageElement && img instanceof self.HTMLImageElement)) + && !img.complete) + return false; + /* if ((self.Image && img instanceof self.Image) || (self.HTMLImageElement && img instanceof self.HTMLImageElement) && !img.complete) return false; + */ if (!imageHasData(img)) { getImageData(img, callback); diff --git a/wire/modules/Inputfield/InputfieldImage/exif.min.js b/wire/modules/Inputfield/InputfieldImage/exif.min.js index 97b8a6ed..17377841 100644 --- a/wire/modules/Inputfield/InputfieldImage/exif.min.js +++ b/wire/modules/Inputfield/InputfieldImage/exif.min.js @@ -1 +1 @@ -(function(){var q=false;var s=this;var f=function(A){if(A instanceof f){return A}if(!(this instanceof f)){return new f(A)}this.EXIFwrapped=A};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=f}exports.EXIF=f}else{s.EXIF=f}var w=f.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"};var z=f.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"};var p=f.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"};var o=f.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"};var k=f.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function t(A,C,B){if(A.addEventListener){A.addEventListener(C,B,false)}else{if(A.attachEvent){A.attachEvent("on"+C,B)}}}function i(A){return !!(A.exifdata)}function e(D,G){G=G||D.match(/^data\:([^\;]+)\;base64,/mi)[1]||"";D=D.replace(/^data\:([^\;]+)\;base64,/gmi,"");var F=atob(D);var A=F.length;var C=new ArrayBuffer(A);var B=new Uint8Array(C);for(var E=0;E4?B:(J+8);K=[];for(D=0;D4?B:(J+8);return r(F,G,L-1);case 3:if(L==1){return F.getUint16(J+8,!H)}else{G=L>2?B:(J+8);K=[];for(D=0;DH.byteLength){return{}}}var A=u(H,G,G+B,o,D);if(A.Compression){switch(A.Compression){case 6:if(A.JpegIFOffset&&A.JpegIFByteCount){var F=G+A.JpegIFOffset;var C=A.JpegIFByteCount;A.blob=new Blob([new Uint8Array(H.buffer,F,C)],{type:"image/jpeg"})}break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",A.Compression)}}else{if(A.PhotometricInterpretation==2){console.log("Thumbnail image format is RGB, which is not implemented.")}}return A}function r(B,D,C){var A="";for(n=D;n")+8;I=I.substring(I.indexOf("0){R["@attributes"]={};for(var O=0;O0){for(var F=0;F4?B:(J+8);K=[];for(D=0;D4?B:(J+8);return r(F,G,L-1);case 3:if(L==1){return F.getUint16(J+8,!H)}else{G=L>2?B:(J+8);K=[];for(D=0;DH.byteLength){return{}}}var A=u(H,G,G+B,o,D);if(A.Compression){switch(A.Compression){case 6:if(A.JpegIFOffset&&A.JpegIFByteCount){var F=G+A.JpegIFOffset;var C=A.JpegIFByteCount;A.blob=new Blob([new Uint8Array(H.buffer,F,C)],{type:"image/jpeg"})}break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",A.Compression)}}else{if(A.PhotometricInterpretation==2){console.log("Thumbnail image format is RGB, which is not implemented.")}}return A}function r(B,D,C){var A="";for(n=D;n")+8;I=I.substring(I.indexOf("0){R["@attributes"]={};for(var O=0;O0){for(var F=0;F