1 |
- webpackJsonp([26],{DOrY:function(t,e,i){"use strict";var n=i("sbrb"),a=i.n(n),o=i("mtWM"),s=i.n(o),r=(i("vLgD"),i("PJh5")),h=i.n(r),l={name:"vueImgCropper",props:{width:{type:Number,default:500},height:{type:Number,default:500},maxScale:{type:Number,default:4},footerHeight:{type:Number,default:window.innerWidth/6.4*.88},compressionRatio:{type:Number,default:.92}},data:function(){return{config:{},show:!1,touch:!1,touchmoveTime:0,ratio:1,nativeWindowHeight:window.innerHeight,windowHeight:window.innerHeight-this.$props.footerHeight,windowWidth:window.innerWidth,singlePoint:null,speedX:0,speedY:0,scale:1,d:0,dx:0,dy:0,boxWidth:0,boxHeight:0,boxTop:0,boxLeft:0,naturalWidth:0,naturalHeight:0,startWidth:0,startHeight:0,imgTop:0,imgLeft:0,fileType:"",minScale:1,maskWidth:0,maskHeight:0,info:"",duration:0,timingFunction:"ease-in-out",easingTime:2e3,ouOfRangeEasing:300,remainingTime:0}},methods:{getImg:function(){this.$refs.fileInput.click()},showLoading:function(){this.$emit("showLoading")},hideLoading:function(){this.$emit("hideLoading")},changeFun:function(t){var e=this,i=t.target.files[0];if(e.fileType=i.type,!/image\/\w+/.test(i.type))return this.$emit("showError","文件必须为图片!"),!1;if(this.showLoading(),"undefined"==typeof FileReader)return this.hideLoading(),void this.$emit("showError","抱歉,你的浏览器不支持 FileReader");var n=new FileReader;n.readAsDataURL(i),n.onload=function(t){var n=this.result;a.a.getData(i,function(){a.a.getAllTags(this);var t=a.a.getTag(this,"Orientation"),i=new Image;i.onload=function(){var i,n,a=0,o=void 0,s=void 0;o=this.naturalWidth,s=this.naturalHeight;var r=document.createElement("canvas");r.width=i=o,r.height=n=s;var h=r.getContext("2d");switch(t){case 3:a=180,o=-i,s=-n;break;case 6:r.width=n,r.height=i,a=90,o=i,s=-n;break;case 8:r.width=n,r.height=i,a=270,o=-i,s=n}h.rotate(a*Math.PI/180),h.drawImage(this,0,0,o,s);var l=new Image;l.onload=function(){var t=this.naturalWidth,i=this.naturalHeight;e.naturalWidth=this.naturalWidth,e.naturalHeight=this.naturalHeight;var n=e.$refs.img;e.windowHeight/e.windowWidth>=e.height/e.width?(e.startWidth=e.windowWidth,e.startHeight=i/t*e.windowWidth,e.imgTop=(e.windowHeight-e.startHeight)/2,e.imgLeft=0,e.boxWidth=e.startWidth,e.boxHeight=e.boxWidth*e.ratio,e.boxTop=(e.windowHeight-e.boxHeight)/2,e.boxLeft=0,e.maskHeight=(e.windowHeight-e.boxHeight)/2,e.maskWidth=0):(e.startHeight=e.windowHeight,e.startWidth=t/i*e.windowHeight,e.imgLeft=(e.windowWidth-e.startWidth)/2,e.imgTop=0,e.boxHeight=e.startHeight,e.boxWidth=e.boxHeight/e.ratio,e.boxLeft=(e.windowWidth-e.boxWidth)/2,e.boxTop=0),n.setAttribute("src",l.src),e.scale=1,e.dx=0,e.dy=0,e.hideLoading(),e.show=!0},l.src=r.toDataURL(e.fileType)},i.src=n})}},hidePage:function(){this.$parent.showImgPage=!1,this.show=!1,this.cleanInput()},touchstart:function(t){this.touch=!0},mouseWheel:function(t){var e=this,i=.1;t.deltaY>0?(this.scale<this.minScale&&(i/=3),this.scale=this.scale-i):(this.scale>this.maxScale&&(i/=3),this.scale=this.scale+i),setTimeout(function(){e.resetImg()},0)},touchmove:function(t){if(this.touch=!0,t.preventDefault(),t.targetTouches.length>=2||t.touches.length>=2){var e="",i="",n=[],a=[];t.targetTouches.length>=2?(n=[(e=t.targetTouches[0]).pageX,e.pageY],a=[(i=t.targetTouches[1]).pageX,i.pageY]):(n=[(e=t.touches[0]).pageX,e.pageY],a=[(i=t.touches[1]).pageX,i.pageY]);var o=Math.sqrt((n[0]-a[0])*(n[0]-a[0])+(n[1]-a[1])*(n[1]-a[1]));if(0===this.d)return void(this.d=o);var s=(o-this.d)/this.d;(this.scale>this.maxScale&&s>0||this.scale<.8&&s<0)&&(s/=3),this.scale=this.scale+s,this.d=o}else if(1===t.targetTouches.length){var r=t.targetTouches[0],h={x:r.pageX,y:r.pageY},l=Date.now();if(!this.singlePoint)return this.singlePoint=h,this.speedX=0,this.speedY=0,void(this.touchmoveTime=l);var c=this.dx+h.x-this.singlePoint.x,u=this.dy+h.y-this.singlePoint.y,d=l-this.touchmoveTime;this.speedX=(h.x-this.singlePoint.x)/d,this.speedY=(h.y-this.singlePoint.y)/d;var g=this.getRange();c>g.maxDx||c<g.minDx?this.dx+=(h.x-this.singlePoint.x)/3:this.dx+=h.x-this.singlePoint.x,u>g.maxDy||u<g.minDy?this.dy+=(h.y-this.singlePoint.y)/3:this.dy+=h.y-this.singlePoint.y,this.touchmoveTime=Date.now(),this.singlePoint=h}},touchend:function(){this.touch=!1,this.d=0,this.singlePoint=null,this.inertiaMoving()},inertiaMoving:function(){var t=this,e=Date.now(),i=this.easingTime,n=this.getRange();if(this.dx<n.minDx||this.dx>n.maxDx||this.dy<n.minDy||this.dy>n.maxDy)this.speedX=0,this.speedY=0,this.resetImg();else if(e-this.touchmoveTime>40||Math.abs(this.speedX)<.2&&Math.abs(this.speedY)<.2)this.speedX=0,this.speedY=0,this.resetImg();else{var a=-this.speedX/this.easingTime,o=-this.speedY/this.easingTime,s=this.dx,r=this.dy,h=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},l=0,c=0,u=0,d=0,g=0,m=0,f=0,p=0;!function v(){var x=Date.now()-e;if(!t.touch&&x<=i){var w=t.speedX*x+.5*a*x*x,y=t.speedY*x+.5*o*x*x,b=s+w/2,S=r+y/2;if(0!==l)if(x<=l){var D=x-l+t.ouOfRangeEasing;t.dx=u+(f*D+g*D*D)}else t.dx=u;else if(0===l){var C=t.easingTime-x;(b>n.maxDx||b<n.minDx)&&(u=b>n.maxDx?n.maxDx:n.minDx,g=-(f=-a*C/2)/t.ouOfRangeEasing,l=x+t.ouOfRangeEasing,i=l>i?l:i),t.dx=b}if(0!==c)if(x<=c){var F=x-c+t.ouOfRangeEasing;t.dy=d+(p*F+m*F*F)}else t.dy=d;else if(0===c){var P=t.easingTime-x;(S>n.maxDy||S<n.minDy)&&(d=S>n.maxDy?n.maxDy:n.minDy,m=-(p=-o*P/2)/t.ouOfRangeEasing,c=x+t.ouOfRangeEasing,i=c>i?c:i),t.dy=S}h(v)}}()}},resetImg:function(){var t,e,i,n,a,o=this,s=this.getRange(),r=this.dx,h=this.dy,l=this.scale,c=0,u=0,d=0;if(this.dx<s.minDx?c=s.minDx-this.dx:this.dx>s.maxDx&&(c=s.maxDx-this.dx),this.dy<s.minDy?u=s.minDy-this.dy:this.dy>s.maxDy&&(u=s.maxDy-this.dy),this.scale<this.minScale?d=this.minScale-this.scale:this.scale>this.maxScale&&(d=this.maxScale-this.scale),0!==c||0!==u||0!==d){t=-2*c/(this.ouOfRangeEasing*this.ouOfRangeEasing),i=-t*this.ouOfRangeEasing,e=-2*u/(this.ouOfRangeEasing*this.ouOfRangeEasing),n=-e*this.ouOfRangeEasing,a=d/this.ouOfRangeEasing;var g=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},m=Date.now();!function s(){var f=Date.now()-m;if(!o.touch)if(f<=o.ouOfRangeEasing){var p=i*f+.5*t*f*f,v=n*f+.5*e*f*f,x=a*f;o.dx=r+p,o.dy=h+v,o.scale=l+x,g(s)}else o.dx=r+c,o.dy=h+u,o.scale=l+d}()}},getRange:function(){var t=this.scale,e=this.scale;t<this.minScale&&(t=this.minScale),e>this.maxScale&&(e=this.maxScale);var i=-(this.startWidth*t-this.boxWidth)/2,n=-(this.startHeight*t-this.boxHeight)/2,a=(this.startWidth*t-this.boxWidth)/2,o=(this.startHeight*t-this.boxHeight)/2;return i>a&&(i=0,a=0),n>o&&(n=0,o=0),{minDx:i,minDy:n,maxDx:a,maxDy:o}},cutImg:function(){var t=this.$refs.canvas,e=t.getContext("2d"),i=this.$refs.img,n=this.getRange(),a=this.startWidth*this.scale,o=this.startHeight*this.scale,s=(-this.dx-n.minDx)/a*this.naturalWidth,r=(-this.dy-n.minDy)/o*this.naturalHeight,h=this.boxWidth/a*this.naturalWidth,l=this.boxHeight/o*this.naturalHeight;if(0==n.maxDx&&0==n.maxDy&&0==n.minDx&&0==n.minDy&&this.startHeight<this.boxHeight){var c=this.boxHeight/(this.startHeight*this.scale);s=(-this.dx+this.boxWidth*c-this.boxWidth)/2/(this.boxWidth*c)*this.naturalWidth,r=0,h=h*this.startHeight/this.boxHeight,l=l*this.startHeight/this.boxHeight}e.drawImage(i,s,r,h,l,0,0,this.width,this.height),e.save();var u=t.toDataURL(this.fileType,this.compressionRatio);this.getSign({file:this.dataURLtoFile(u,this.random_string(32))},u),this.cleanInput(),this.show=!1},dataURLtoFile:function(t,e){for(var i=t.split(","),n=i[0].match(/:(.*?);/)[1],a=atob(i[1]),o=a.length,s=new Uint8Array(o);o--;)s[o]=a.charCodeAt(o);return new File([s],e,{type:n})},maskToucmove:function(t){t.preventDefault()},cleanInput:function(){this.$refs.fileForm.reset()},getBlobBydataURI:function(t,e){for(var i=atob(t.split(",")[1]),n=[],a=0;a<i.length;a++)n.push(i.charCodeAt(a));return new Blob([new Uint8Array(n)],{type:e})},random_string:function(t){t=t||32;for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",i=e.length,n="",a=0;a<t;a++)n+=e.charAt(Math.floor(Math.random()*i));return n},upload:function(t,e){var i=this,n=t.file,a=t.file.name,o=(h()().format("YYYY/MM/DD"),new FormData),r=(this.random_string(32),this.config.key);o.append("Filename",a),o.append("key",r),o.append("policy",this.config.policy),o.append("OSSAccessKeyId",this.config.id),o.append("success_action_status","200"),o.append("callback",this.config.callback),o.append("signature",this.config.signature),o.append("file",n),s.a.post("https://integralsys.oss-cn-shenzhen.aliyuncs.com",o,{headers:{"Content-Type":"multipart/form-data"}}).then(function(t){200==t.status&&"OK"==t.statusText&&i.$emit("cutImg",{url:"http://cdn.intesys.g107.com/"+r,data:e}),i.$toast.clear()}).catch(function(t){i.$toast.clear(),console.log("err == ",t)})},getSign:function(t,e){var i=this;this.$toast.loading({mask:!0,message:"正在上传"}),s.a.post("https://intesys.cms.g107.com/integral.php/Api/get_signature",{md5:this.random_string(32),name:t.file.name}).then(function(n){i.config={callback:"",expire:n.data.data.expire,key:"intesys/"+h()().format("YYYY-MM-DD")+"/"+i.random_string(32)+".jpg",id:n.data.data.accessid,signature:n.data.data.signature,policy:n.data.data.policy},i.upload(t,e)})}},created:function(){0===this.height||0===this.width?this.ratio=1:this.ratio=this.height/this.width}},c={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vue-img-cropper"},[i("canvas",{ref:"canvas",staticClass:"page-canvas",attrs:{height:t.height,width:t.width}}),t._v(" "),i("div",{staticStyle:{position:"relative"}},[i("form",{ref:"fileForm",staticClass:"form"},[i("label",{staticStyle:{position:"absolute",top:"0",left:"0",bottom:"0",right:"0","z-index":"2"}},[i("input",{ref:"fileInput",staticStyle:{opacity:"0"},attrs:{type:"file",accept:"image/*"},on:{change:t.changeFun}})])]),t._v(" "),t._t("default")],2),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"img-page",style:{height:t.nativeWindowHeight+"px",width:t.windowWidth+"px"}},[i("div",{staticClass:"page-body",style:{height:t.windowHeight+"px"}},[i("img",{ref:"img",staticClass:"main-img",style:{top:t.imgTop+"px",left:t.imgLeft+"px",transition:"transform "+t.duration+"s "+t.timingFunction,transform:"translateX("+t.dx+"px) translateY("+t.dy+"px) translateZ(0) scale("+t.scale+")"},attrs:{width:t.startWidth,height:t.startHeight}}),t._v(" "),i("div",{staticClass:"img-mask top",style:{height:t.maskHeight+"px"},on:{touchmove:t.maskToucmove}}),t._v(" "),i("div",{staticClass:"img-mask bottom",style:{height:t.maskHeight+"px"},on:{touchmove:t.maskToucmove}}),t._v(" "),i("div",{staticClass:"img-mask left",style:{width:t.maskWidth+"px"},on:{touchmove:t.maskToucmove}}),t._v(" "),i("div",{staticClass:"img-mask right",style:{width:t.maskWidth+"px"},on:{touchmove:t.maskToucmove}}),t._v(" "),i("div",{ref:"box",staticClass:"cut-box",style:{height:t.boxHeight+"px",width:t.boxWidth+"px",top:t.boxTop+"px",left:t.boxLeft+"px"},on:{wheel:t.mouseWheel,touchstart:t.touchstart,touchmove:t.touchmove,touchend:t.touchend}})]),t._v(" "),i("div",{staticClass:"page-footer",style:{height:t.footerHeight+"px","line-height":t.footerHeight+"px"}},[i("div",{staticClass:"page-footer-btn",on:{click:t.hidePage}},[t._v("取消")]),t._v(" "),i("div",{staticClass:"page-footer-btn",on:{click:t.cutImg}},[t._v("选取")])])])])},staticRenderFns:[]};var u=i("VU/8")(l,c,!1,function(t){i("RQd1")},null,null);e.a=u.exports},Iizz:function(t,e){},JCHq:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});i("OWWB");var n=i("1fWZ"),a=(i("i0mo"),i("Hkar")),o=(i("LlGJ"),i("Wtz3")),s=i("7+uW"),r=i("TIfe"),h=i("l9V+"),l=i("DOrY"),c=i("EdRh");s.a.use(n.a).use(a.a).use(o.a);var u={name:"personal_information",filters:{mobile:function(t){return t?""==t?t:t.replace(t.substring(3,7),"****"):""}},data:function(){return{account_info:this.$store.getters.account_info}},components:{VueImgCropper:l.a,userImage:c.a},computed:{user_info:function(){return this.$store.getters.user_info||{}}},methods:{showCutImg:function(t){this.sendAvatarRequest(t.url)},showLoading:function(){this.$toast.loading({mask:!0,message:"正在处理"})},hideLoading:function(){this.$toast.clear()},showError:function(){},onChangeAvatar:function(){this.$refs.cropper.getImg()},sendAvatarRequest:function(t){var e=this,i={name:this.$store.getters.user_info.name,img_url:t};Object(h.a)({url:"/api/account/edit",method:"post",data:i}).then(function(i){200===i.status&&1==i.data.code&&(e.$store.getters.account_info.img_url=t,e.$toast.clear(),e.$toast("保存成功"))}).catch(function(t){console.log(t)})},clearCacheHandle:function(){var t=this;this.$dialog.confirm({title:"清除缓存",message:"您确定要清除缓存吗?"}).then(function(){t.$store.dispatch("clear_cache"),t.$toast("清除成功")}).catch(function(){return null})},logoutHandle:function(){var t=this;this.$toast.loading({mask:!0,message:"正在处理"}),this.$dialog.confirm({title:"退出登录",message:"您确定要退出吗?"}).then(function(){Object(h.a)({url:"/api/logout",method:"post",data:{type:"app"}}).then(function(e){"html5plus"===window.navigator.userAgent.toLowerCase().match(/html5plus/i)?plus.storage.removeItem("user_info"):localStorage.removeItem("user_info"),t.clearCacheData(),t.$toast.clear()})}).catch(function(){return null})},clearCacheData:function(){Object(r.c)(),this.$store.dispatch("clear_cache"),this.$router.push({name:"login"})}}},d={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"per-info__container"},[i("van-nav-bar",{attrs:{title:"个人信息","left-text":"返回","left-arrow":""},on:{"click-left":t.$route_back}}),t._v(" "),i("van-cell-group",[i("van-cell",{attrs:{title:"头像","is-link":""}},[[i("vue-img-cropper",{ref:"cropper",attrs:{height:400,width:400,maxScale:6,compressionRatio:.5},on:{cutImg:t.showCutImg,showLoading:t.showLoading,hideLoading:t.hideLoading,showError:t.showError}},[i("userImage",{attrs:{id:t.account_info.id,img_url:t.account_info.img_url,width:"0.5rem",height:"0.5rem",user_name:t.account_info.name,fontSize:"0.2"}})],1)]],2),t._v(" "),i("van-cell",{attrs:{title:"姓名",value:t.account_info.name,to:"username_edit","is-link":""}},[i("template",{slot:"value"},[i("span",{staticClass:"per-info__tel"},[t._v(t._s(t.account_info.name))])])],2),t._v(" "),i("van-cell",{attrs:{title:"手机号","is-link":"",to:"user_mobile"}},[i("template",{slot:"default"},[i("span",{staticClass:"per-info__tel"},[t._v(t._s(t._f("mobile")(t.account_info.tel)))])])],2)],1),t._v(" "),i("van-cell-group",[i("van-cell",{attrs:{title:"修改密码",to:"change_pwd","is-link":""}})],1),t._v(" "),i("van-cell-group",[i("van-cell",{attrs:{title:"清理缓存"},on:{click:t.clearCacheHandle}})],1),t._v(" "),i("van-cell-group",[i("div",{staticClass:"login-out__button",on:{click:t.logoutHandle}},[i("span",[t._v("退出登录")])])])],1)},staticRenderFns:[]};var g=i("VU/8")(u,d,!1,function(t){i("Iizz")},"data-v-3309e7a9",null);e.default=g.exports},RQd1:function(t,e){},sbrb:function(t,e,i){var a;(function(){var i=!1,o=function(t){return t instanceof o?t:this instanceof o?void(this.EXIFwrapped=t):new o(t)};void 0!==t&&t.exports&&(e=t.exports=o),e.EXIF=o;var s=o.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"},r=o.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"},h=o.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"},l=o.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"},c=o.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 u(t){return!!t.exifdata}function d(t,e){function n(n){var a=g(n);t.exifdata=a||{};var s=function(t){var e=new DataView(t);i&&console.log("Got file of length "+t.byteLength);if(255!=e.getUint8(0)||216!=e.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;var n=2,a=t.byteLength,o=function(t,e){return 56===t.getUint8(e)&&66===t.getUint8(e+1)&&73===t.getUint8(e+2)&&77===t.getUint8(e+3)&&4===t.getUint8(e+4)&&4===t.getUint8(e+5)};for(;n<a;){if(o(e,n)){var s=e.getUint8(n+7);s%2!=0&&(s+=1),0===s&&(s=4);var r=n+8+s,h=e.getUint16(n+6+s);return f(t,r,h)}n++}}(n);if(t.iptcdata=s||{},o.isXmpEnabled){var r=function(t){if(!("DOMParser"in self))return;var e=new DataView(t);i&&console.log("Got file of length "+t.byteLength);if(255!=e.getUint8(0)||216!=e.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;var n=2,a=t.byteLength,o=new DOMParser;for(;n<a-4;){if("http"==x(e,n,4)){var s=n-1,r=e.getUint16(n-2)-1,h=x(e,s,r),l=h.indexOf("xmpmeta>")+8,c=(h=h.substring(h.indexOf("<x:xmpmeta"),l)).indexOf("x:xmpmeta")+10;h=h.slice(0,c)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+h.slice(c);var u=o.parseFromString(h,"text/xml");return b(u)}n++}}(n);t.xmpdata=r||{}}e&&e.call(t)}if(t.src)if(/^data\:/i.test(t.src))n(function(t,e){e=e||t.match(/^data\:([^\;]+)\;base64,/im)[1]||"",t=t.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var i=atob(t),n=i.length,a=new ArrayBuffer(n),o=new Uint8Array(a),s=0;s<n;s++)o[s]=i.charCodeAt(s);return a}(t.src));else if(/^blob\:/i.test(t.src)){(s=new FileReader).onload=function(t){n(t.target.result)},function(t,e){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="blob",i.onload=function(t){200!=this.status&&0!==this.status||e(this.response)},i.send()}(t.src,function(t){s.readAsArrayBuffer(t)})}else{var a=new XMLHttpRequest;a.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";n(a.response),a=null},a.open("GET",t.src,!0),a.responseType="arraybuffer",a.send(null)}else if(self.FileReader&&(t instanceof self.Blob||t instanceof self.File)){var s;(s=new FileReader).onload=function(t){i&&console.log("Got file of length "+t.target.result.byteLength),n(t.target.result)},s.readAsArrayBuffer(t)}}function g(t){var e=new DataView(t);if(i&&console.log("Got file of length "+t.byteLength),255!=e.getUint8(0)||216!=e.getUint8(1))return i&&console.log("Not a valid JPEG"),!1;for(var n,a=2,o=t.byteLength;a<o;){if(255!=e.getUint8(a))return i&&console.log("Not a valid marker at offset "+a+", found: "+e.getUint8(a)),!1;if(n=e.getUint8(a+1),i&&console.log(n),225==n)return i&&console.log("Found 0xFFE1 marker"),w(e,a+4,e.getUint16(a+2));a+=2+e.getUint16(a+2)}}var m={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};function f(t,e,i){for(var n,a,o,s,r=new DataView(t),h={},l=e;l<e+i;)28===r.getUint8(l)&&2===r.getUint8(l+1)&&(s=r.getUint8(l+2))in m&&((o=r.getInt16(l+3))+5,a=m[s],n=x(r,l+5,o),h.hasOwnProperty(a)?h[a]instanceof Array?h[a].push(n):h[a]=[h[a],n]:h[a]=n),l++;return h}function p(t,e,n,a,o){var s,r,h,l=t.getUint16(n,!o),c={};for(h=0;h<l;h++)s=n+12*h+2,!(r=a[t.getUint16(s,!o)])&&i&&console.log("Unknown tag: "+t.getUint16(s,!o)),c[r]=v(t,s,e,n,o);return c}function v(t,e,i,n,a){var o,s,r,h,l,c,u=t.getUint16(e+2,!a),d=t.getUint32(e+4,!a),g=t.getUint32(e+8,!a)+i;switch(u){case 1:case 7:if(1==d)return t.getUint8(e+8,!a);for(o=d>4?g:e+8,s=[],h=0;h<d;h++)s[h]=t.getUint8(o+h);return s;case 2:return x(t,o=d>4?g:e+8,d-1);case 3:if(1==d)return t.getUint16(e+8,!a);for(o=d>2?g:e+8,s=[],h=0;h<d;h++)s[h]=t.getUint16(o+2*h,!a);return s;case 4:if(1==d)return t.getUint32(e+8,!a);for(s=[],h=0;h<d;h++)s[h]=t.getUint32(g+4*h,!a);return s;case 5:if(1==d)return l=t.getUint32(g,!a),c=t.getUint32(g+4,!a),(r=new Number(l/c)).numerator=l,r.denominator=c,r;for(s=[],h=0;h<d;h++)l=t.getUint32(g+8*h,!a),c=t.getUint32(g+4+8*h,!a),s[h]=new Number(l/c),s[h].numerator=l,s[h].denominator=c;return s;case 9:if(1==d)return t.getInt32(e+8,!a);for(s=[],h=0;h<d;h++)s[h]=t.getInt32(g+4*h,!a);return s;case 10:if(1==d)return t.getInt32(g,!a)/t.getInt32(g+4,!a);for(s=[],h=0;h<d;h++)s[h]=t.getInt32(g+8*h,!a)/t.getInt32(g+4+8*h,!a);return s}}function x(t,e,i){var a="";for(n=e;n<e+i;n++)a+=String.fromCharCode(t.getUint8(n));return a}function w(t,e){if("Exif"!=x(t,e,4))return i&&console.log("Not valid EXIF data! "+x(t,e,4)),!1;var n,a,o,u,d,g=e+6;if(18761==t.getUint16(g))n=!1;else{if(19789!=t.getUint16(g))return i&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;n=!0}if(42!=t.getUint16(g+2,!n))return i&&console.log("Not valid TIFF data! (no 0x002A)"),!1;var m=t.getUint32(g+4,!n);if(m<8)return i&&console.log("Not valid TIFF data! (First offset less than 8)",t.getUint32(g+4,!n)),!1;if((a=p(t,g,g+m,r,n)).ExifIFDPointer)for(o in u=p(t,g,g+a.ExifIFDPointer,s,n)){switch(o){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":u[o]=c[o][u[o]];break;case"ExifVersion":case"FlashpixVersion":u[o]=String.fromCharCode(u[o][0],u[o][1],u[o][2],u[o][3]);break;case"ComponentsConfiguration":u[o]=c.Components[u[o][0]]+c.Components[u[o][1]]+c.Components[u[o][2]]+c.Components[u[o][3]]}a[o]=u[o]}if(a.GPSInfoIFDPointer)for(o in d=p(t,g,g+a.GPSInfoIFDPointer,h,n)){switch(o){case"GPSVersionID":d[o]=d[o][0]+"."+d[o][1]+"."+d[o][2]+"."+d[o][3]}a[o]=d[o]}return a.thumbnail=function(t,e,i,n){var a=function(t,e,i){var n=t.getUint16(e,!i);return t.getUint32(e+2+12*n,!i)}(t,e+i,n);if(!a)return{};if(a>t.byteLength)return{};var o=p(t,e,e+a,l,n);if(o.Compression)switch(o.Compression){case 6:if(o.JpegIFOffset&&o.JpegIFByteCount){var s=e+o.JpegIFOffset,r=o.JpegIFByteCount;o.blob=new Blob([new Uint8Array(t.buffer,s,r)],{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'",o.Compression)}else 2==o.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return o}(t,g,m,n),a}function y(t){var e={};if(1==t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(var i=0;i<t.attributes.length;i++){var n=t.attributes.item(i);e["@attributes"][n.nodeName]=n.nodeValue}}}else if(3==t.nodeType)return t.nodeValue;if(t.hasChildNodes())for(var a=0;a<t.childNodes.length;a++){var o=t.childNodes.item(a),s=o.nodeName;if(null==e[s])e[s]=y(o);else{if(null==e[s].push){var r=e[s];e[s]=[],e[s].push(r)}e[s].push(y(o))}}return e}function b(t){try{var e={};if(t.children.length>0)for(var i=0;i<t.children.length;i++){var n=t.children.item(i),a=n.attributes;for(var o in a){var s=a[o],r=s.nodeName,h=s.nodeValue;void 0!==r&&(e[r]=h)}var l=n.nodeName;if(void 0===e[l])e[l]=y(n);else{if(void 0===e[l].push){var c=e[l];e[l]=[],e[l].push(c)}e[l].push(y(n))}}else e=t.textContent;return e}catch(t){console.log(t.message)}}o.enableXmp=function(){o.isXmpEnabled=!0},o.disableXmp=function(){o.isXmpEnabled=!1},o.getData=function(t,e){return!((self.Image&&t instanceof self.Image||self.HTMLImageElement&&t instanceof self.HTMLImageElement)&&!t.complete)&&(u(t)?e&&e.call(t):d(t,e),!0)},o.getTag=function(t,e){if(u(t))return t.exifdata[e]},o.getIptcTag=function(t,e){if(u(t))return t.iptcdata[e]},o.getAllTags=function(t){if(!u(t))return{};var e,i=t.exifdata,n={};for(e in i)i.hasOwnProperty(e)&&(n[e]=i[e]);return n},o.getAllIptcTags=function(t){if(!u(t))return{};var e,i=t.iptcdata,n={};for(e in i)i.hasOwnProperty(e)&&(n[e]=i[e]);return n},o.pretty=function(t){if(!u(t))return"";var e,i=t.exifdata,n="";for(e in i)i.hasOwnProperty(e)&&("object"==typeof i[e]?i[e]instanceof Number?n+=e+" : "+i[e]+" ["+i[e].numerator+"/"+i[e].denominator+"]\r\n":n+=e+" : ["+i[e].length+" values]\r\n":n+=e+" : "+i[e]+"\r\n");return n},o.readFromBinaryFile=function(t){return g(t)},void 0===(a=function(){return o}.apply(e,[]))||(t.exports=a)}).call(this)}});
|