1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["test"],{6666:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticStyle:{padding:"20px"}},[n("div",{staticClass:"show"},[n("div",{staticClass:"picture",style:"backgroundImage:url("+e.headerImage+")"})]),n("div",{staticStyle:{"margin-top":"20px"}},[n("input",{attrs:{type:"file",id:"upload",accept:"image"},on:{change:e.upload}}),n("label",{attrs:{for:"upload"}})])])])},i=[],a=n("6f45"),o=n.n(a),s={data:function(){return{headerImage:"",picValue:""}},mounted:function(){},methods:{upload:function(e){var t=e.target.files||e.dataTransfer.files;t.length&&(this.picValue=t[0],this.imgPreview(this.picValue))},imgPreview:function(e){var t,n=this;if(o.a.getData(e,(function(){t=o.a.getTag(this,"Orientation")})),e&&window.FileReader&&/^image/.test(e.type)){var r=new FileReader;r.readAsDataURL(e),r.onloadend=function(){var e=this.result,r=new Image;r.src=e,this.result.length<=102400?(n.headerImage=this.result,n.postImg()):r.onload=function(){var e=n.compress(r,t);n.headerImage=e,n.postImg()}}}},postImg:function(){},rotateImg:function(e,t,n){var r=0,i=3;if(null!=e){var a=e.height,o=e.width,s=2;null==s&&(s=r),"right"==t?(s++,s>i&&(s=r)):(s--,s<r&&(s=i));var l=90*s*Math.PI/180,c=n.getContext("2d");switch(s){case 0:n.width=o,n.height=a,c.drawImage(e,0,0);break;case 1:n.width=a,n.height=o,c.rotate(l),c.drawImage(e,0,-a);break;case 2:n.width=o,n.height=a,c.rotate(l),c.drawImage(e,-o,-a);break;case 3:n.width=a,n.height=o,c.rotate(l),c.drawImage(e,-o,0);break}}},compress:function(e,t){var n,r,i=document.createElement("canvas"),a=i.getContext("2d"),o=document.createElement("canvas"),s=o.getContext("2d"),l=e.src.length,c=e.width,u=e.height;if((n=c*u/4e6)>1?(console.log("大于400万像素"),n=Math.sqrt(n),c/=n,u/=n):n=1,i.width=c,i.height=u,a.fillStyle="#fff",a.fillRect(0,0,i.width,i.height),(r=c*u/1e6)>1){console.log("超过100W像素"),r=~~(Math.sqrt(r)+1);var d=~~(c/r),g=~~(u/r);o.width=d,o.height=g;for(var f=0;f<r;f++)for(var h=0;h<r;h++)s.drawImage(e,f*d*n,h*g*n,d*n,g*n,0,0,d,g),a.drawImage(o,f*d,h*g,d,g)}else a.drawImage(e,0,0,c,u);if(""!=t&&1!=t)switch(t){case 6:this.rotateImg(e,"left",i);break;case 8:this.rotateImg(e,"right",i);break;case 3:this.rotateImg(e,"right",i),this.rotateImg(e,"right",i);break}var m=i.toDataURL("image/jpeg",.1);return console.log("压缩前:"+l),console.log("压缩后:"+m.length),console.log("压缩率:"+~~(100*(l-m.length)/l)+"%"),o.width=o.height=i.width=i.height=0,m}}},l=s,c=(n("7182"),n("2877")),u=Object(c["a"])(l,r,i,!1,null,null,null);t["default"]=u.exports},"6f45":function(e,t,r){var i,a;(function(){var r=!1,o=function(e){return e instanceof o?e:this instanceof o?void(this.EXIFwrapped=e):new o(e)};e.exports&&(t=e.exports=o),t.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"},l=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"},c=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"},u=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"},d=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 g(e){return!!e.exifdata}function f(e,t){t=t||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var n=atob(e),r=n.length,i=new ArrayBuffer(r),a=new Uint8Array(i),o=0;o<r;o++)a[o]=n.charCodeAt(o);return i}function h(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){200!=this.status&&0!==this.status||t(this.response)},n.send()}function m(e,t){function n(n){var r=p(n);e.exifdata=r||{};var i=S(n);if(e.iptcdata=i||{},o.isXmpEnabled){var a=x(n);e.xmpdata=a||{}}t&&t.call(e)}if(e.src)if(/^data\:/i.test(e.src)){var i=f(e.src);n(i)}else if(/^blob\:/i.test(e.src)){var a=new FileReader;a.onload=function(e){n(e.target.result)},h(e.src,(function(e){a.readAsArrayBuffer(e)}))}else{var s=new XMLHttpRequest;s.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";n(s.response),s=null},s.open("GET",e.src,!0),s.responseType="arraybuffer",s.send(null)}else if(self.FileReader&&(e instanceof self.Blob||e instanceof self.File)){a=new FileReader;a.onload=function(e){r&&console.log("Got file of length "+e.target.result.byteLength),n(e.target.result)},a.readAsArrayBuffer(e)}}function p(e){var t=new DataView(e);if(r&&console.log("Got file of length "+e.byteLength),255!=t.getUint8(0)||216!=t.getUint8(1))return r&&console.log("Not a valid JPEG"),!1;var n,i=2,a=e.byteLength;while(i<a){if(255!=t.getUint8(i))return r&&console.log("Not a valid marker at offset "+i+", found: "+t.getUint8(i)),!1;if(n=t.getUint8(i+1),r&&console.log(n),225==n)return r&&console.log("Found 0xFFE1 marker"),C(t,i+4,t.getUint16(i+2)-2);i+=2+t.getUint16(i+2)}}function S(e){var t=new DataView(e);if(r&&console.log("Got file of length "+e.byteLength),255!=t.getUint8(0)||216!=t.getUint8(1))return r&&console.log("Not a valid JPEG"),!1;var n=2,i=e.byteLength,a=function(e,t){return 56===e.getUint8(t)&&66===e.getUint8(t+1)&&73===e.getUint8(t+2)&&77===e.getUint8(t+3)&&4===e.getUint8(t+4)&&4===e.getUint8(t+5)};while(n<i){if(a(t,n)){var o=t.getUint8(n+7);o%2!==0&&(o+=1),0===o&&(o=4);var s=n+8+o,l=t.getUint16(n+6+o);return v(e,s,l)}n++}}var w={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};function v(e,t,n){var r,i,a,o,s=new DataView(e),l={},c=t;while(c<t+n)28===s.getUint8(c)&&2===s.getUint8(c+1)&&(o=s.getUint8(c+2),o in w&&(a=s.getInt16(c+3),a+5,i=w[o],r=F(s,c+5,a),l.hasOwnProperty(i)?l[i]instanceof Array?l[i].push(r):l[i]=[l[i],r]:l[i]=r)),c++;return l}function b(e,t,n,i,a){var o,s,l,c=e.getUint16(n,!a),u={};for(l=0;l<c;l++)o=n+12*l+2,s=i[e.getUint16(o,!a)],!s&&r&&console.log("Unknown tag: "+e.getUint16(o,!a)),u[s]=P(e,o,t,n,a);return u}function P(e,t,n,r,i){var a,o,s,l,c,u,d=e.getUint16(t+2,!i),g=e.getUint32(t+4,!i),f=e.getUint32(t+8,!i)+n;switch(d){case 1:case 7:if(1==g)return e.getUint8(t+8,!i);for(a=g>4?f:t+8,o=[],l=0;l<g;l++)o[l]=e.getUint8(a+l);return o;case 2:return a=g>4?f:t+8,F(e,a,g-1);case 3:if(1==g)return e.getUint16(t+8,!i);for(a=g>2?f:t+8,o=[],l=0;l<g;l++)o[l]=e.getUint16(a+2*l,!i);return o;case 4:if(1==g)return e.getUint32(t+8,!i);for(o=[],l=0;l<g;l++)o[l]=e.getUint32(f+4*l,!i);return o;case 5:if(1==g)return c=e.getUint32(f,!i),u=e.getUint32(f+4,!i),s=new Number(c/u),s.numerator=c,s.denominator=u,s;for(o=[],l=0;l<g;l++)c=e.getUint32(f+8*l,!i),u=e.getUint32(f+4+8*l,!i),o[l]=new Number(c/u),o[l].numerator=c,o[l].denominator=u;return o;case 9:if(1==g)return e.getInt32(t+8,!i);for(o=[],l=0;l<g;l++)o[l]=e.getInt32(f+4*l,!i);return o;case 10:if(1==g)return e.getInt32(f,!i)/e.getInt32(f+4,!i);for(o=[],l=0;l<g;l++)o[l]=e.getInt32(f+8*l,!i)/e.getInt32(f+4+8*l,!i);return o}}function I(e,t,n){var r=e.getUint16(t,!n);return e.getUint32(t+2+12*r,!n)}function y(e,t,n,r){var i=I(e,t+n,r);if(!i)return{};if(i>e.byteLength)return{};var a=b(e,t,t+i,u,r);if(a["Compression"])switch(a["Compression"]){case 6:if(a.JpegIFOffset&&a.JpegIFByteCount){var o=t+a.JpegIFOffset,s=a.JpegIFByteCount;a["blob"]=new Blob([new Uint8Array(e.buffer,o,s)],{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 2==a["PhotometricInterpretation"]&&console.log("Thumbnail image format is RGB, which is not implemented.");return a}function F(e,t,r){var i="";for(n=t;n<t+r;n++)i+=String.fromCharCode(e.getUint8(n));return i}function C(e,t){if("Exif"!=F(e,t,4))return r&&console.log("Not valid EXIF data! "+F(e,t,4)),!1;var n,i,a,o,u,g=t+6;if(18761==e.getUint16(g))n=!1;else{if(19789!=e.getUint16(g))return r&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;n=!0}if(42!=e.getUint16(g+2,!n))return r&&console.log("Not valid TIFF data! (no 0x002A)"),!1;var f=e.getUint32(g+4,!n);if(f<8)return r&&console.log("Not valid TIFF data! (First offset less than 8)",e.getUint32(g+4,!n)),!1;if(i=b(e,g,g+f,l,n),i.ExifIFDPointer)for(a in o=b(e,g,g+i.ExifIFDPointer,s,n),o){switch(a){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":o[a]=d[a][o[a]];break;case"ExifVersion":case"FlashpixVersion":o[a]=String.fromCharCode(o[a][0],o[a][1],o[a][2],o[a][3]);break;case"ComponentsConfiguration":o[a]=d.Components[o[a][0]]+d.Components[o[a][1]]+d.Components[o[a][2]]+d.Components[o[a][3]];break}i[a]=o[a]}if(i.GPSInfoIFDPointer)for(a in u=b(e,g,g+i.GPSInfoIFDPointer,c,n),u){switch(a){case"GPSVersionID":u[a]=u[a][0]+"."+u[a][1]+"."+u[a][2]+"."+u[a][3];break}i[a]=u[a]}return i["thumbnail"]=y(e,g,f,n),i}function x(e){if("DOMParser"in self){var t=new DataView(e);if(r&&console.log("Got file of length "+e.byteLength),255!=t.getUint8(0)||216!=t.getUint8(1))return r&&console.log("Not a valid JPEG"),!1;var n=2,i=e.byteLength,a=new DOMParser;while(n<i-4){if("http"==F(t,n,4)){var o=n-1,s=t.getUint16(n-2)-1,l=F(t,o,s),c=l.indexOf("xmpmeta>")+8;l=l.substring(l.indexOf("<x:xmpmeta"),c);var u=l.indexOf("x:xmpmeta")+10;l=l.slice(0,u)+'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/" '+l.slice(u);var d=a.parseFromString(l,"text/xml");return U(d)}n++}}}function D(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var n=0;n<e.attributes.length;n++){var r=e.attributes.item(n);t["@attributes"][r.nodeName]=r.nodeValue}}}else if(3==e.nodeType)return e.nodeValue;if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var a=e.childNodes.item(i),o=a.nodeName;if(null==t[o])t[o]=D(a);else{if(null==t[o].push){var s=t[o];t[o]=[],t[o].push(s)}t[o].push(D(a))}}return t}function U(e){try{var t={};if(e.children.length>0)for(var n=0;n<e.children.length;n++){var r=e.children.item(n),i=r.attributes;for(var a in i){var o=i[a],s=o.nodeName,l=o.nodeValue;void 0!==s&&(t[s]=l)}var c=r.nodeName;if("undefined"==typeof t[c])t[c]=D(r);else{if("undefined"==typeof t[c].push){var u=t[c];t[c]=[],t[c].push(u)}t[c].push(D(r))}}else t=e.textContent;return t}catch(d){console.log(d.message)}}o.enableXmp=function(){o.isXmpEnabled=!0},o.disableXmp=function(){o.isXmpEnabled=!1},o.getData=function(e,t){return!((self.Image&&e instanceof self.Image||self.HTMLImageElement&&e instanceof self.HTMLImageElement)&&!e.complete)&&(g(e)?t&&t.call(e):m(e,t),!0)},o.getTag=function(e,t){if(g(e))return e.exifdata[t]},o.getIptcTag=function(e,t){if(g(e))return e.iptcdata[t]},o.getAllTags=function(e){if(!g(e))return{};var t,n=e.exifdata,r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);return r},o.getAllIptcTags=function(e){if(!g(e))return{};var t,n=e.iptcdata,r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);return r},o.pretty=function(e){if(!g(e))return"";var t,n=e.exifdata,r="";for(t in n)n.hasOwnProperty(t)&&("object"==typeof n[t]?n[t]instanceof Number?r+=t+" : "+n[t]+" ["+n[t].numerator+"/"+n[t].denominator+"]\r\n":r+=t+" : ["+n[t].length+" values]\r\n":r+=t+" : "+n[t]+"\r\n");return r},o.readFromBinaryFile=function(e){return p(e)},i=[],a=function(){return o}.apply(t,i),void 0===a||(e.exports=a)}).call(this)},7182:function(e,t,n){"use strict";var r=n("8ac1"),i=n.n(r);i.a},"8ac1":function(e,t,n){}}]);
|