UNPKG

vue-image-upload-resize

Version:

A simple Vue.js component for client-side image upload with resizing

1,593 lines (1,395 loc) 155 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["vue-image-upload-resize"] = factory(); else root["vue-image-upload-resize"] = factory(); })((typeof self !== 'undefined' ? self : this), function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "fb15"); /******/ }) /************************************************************************/ /******/ ({ /***/ "01f9": /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__("2d00"); var $export = __webpack_require__("5ca1"); var redefine = __webpack_require__("2aba"); var hide = __webpack_require__("32e9"); var Iterators = __webpack_require__("84f2"); var $iterCreate = __webpack_require__("41a0"); var setToStringTag = __webpack_require__("7f20"); var getPrototypeOf = __webpack_require__("38fd"); var ITERATOR = __webpack_require__("2b4c")('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function () { return this; }; module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { $iterCreate(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /***/ "02f4": /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__("4588"); var defined = __webpack_require__("be13"); // true -> String#at // false -> String#codePointAt module.exports = function (TO_STRING) { return function (that, pos) { var s = String(defined(that)); var i = toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /***/ "0390": /***/ (function(module, exports, __webpack_require__) { "use strict"; var at = __webpack_require__("02f4")(true); // `AdvanceStringIndex` abstract operation // https://tc39.github.io/ecma262/#sec-advancestringindex module.exports = function (S, index, unicode) { return index + (unicode ? at(S, index).length : 1); }; /***/ }), /***/ "09fa": /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/ecma262/#sec-toindex var toInteger = __webpack_require__("4588"); var toLength = __webpack_require__("9def"); module.exports = function (it) { if (it === undefined) return 0; var number = toInteger(it); var length = toLength(number); if (number !== length) throw RangeError('Wrong length!'); return length; }; /***/ }), /***/ "0a49": /***/ (function(module, exports, __webpack_require__) { // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__("9b43"); var IObject = __webpack_require__("626a"); var toObject = __webpack_require__("4bf8"); var toLength = __webpack_require__("9def"); var asc = __webpack_require__("cd1c"); module.exports = function (TYPE, $create) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || asc; return function ($this, callbackfn, that) { var O = toObject($this); var self = IObject(O); var f = ctx(callbackfn, that, 3); var length = toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (;length > index; index++) if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res; // map else if (res) switch (TYPE) { case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }), /***/ "0bfb": /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.2.5.3 get RegExp.prototype.flags var anObject = __webpack_require__("cb7c"); module.exports = function () { var that = anObject(this); var result = ''; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; /***/ }), /***/ "0d58": /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__("ce10"); var enumBugKeys = __webpack_require__("e11e"); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), /***/ "0f88": /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__("7726"); var hide = __webpack_require__("32e9"); var uid = __webpack_require__("ca5a"); var TYPED = uid('typed_array'); var VIEW = uid('view'); var ABV = !!(global.ArrayBuffer && global.DataView); var CONSTR = ABV; var i = 0; var l = 9; var Typed; var TypedArrayConstructors = ( 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' ).split(','); while (i < l) { if (Typed = global[TypedArrayConstructors[i++]]) { hide(Typed.prototype, TYPED, true); hide(Typed.prototype, VIEW, true); } else CONSTR = false; } module.exports = { ABV: ABV, CONSTR: CONSTR, TYPED: TYPED, VIEW: VIEW }; /***/ }), /***/ "1169": /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__("2d95"); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), /***/ "11e9": /***/ (function(module, exports, __webpack_require__) { var pIE = __webpack_require__("52a7"); var createDesc = __webpack_require__("4630"); var toIObject = __webpack_require__("6821"); var toPrimitive = __webpack_require__("6a99"); var has = __webpack_require__("69a8"); var IE8_DOM_DEFINE = __webpack_require__("c69a"); var gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__("9e1e") ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return gOPD(O, P); } catch (e) { /* empty */ } if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }), /***/ "1495": /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__("86cc"); var anObject = __webpack_require__("cb7c"); var getKeys = __webpack_require__("0d58"); module.exports = __webpack_require__("9e1e") ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = getKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) dP.f(O, P = keys[i++], Properties[P]); return O; }; /***/ }), /***/ "20d0": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* * JavaScript Canvas to Blob * https://github.com/blueimp/JavaScript-Canvas-to-Blob * * Copyright 2012, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * https://opensource.org/licenses/MIT * * Based on stackoverflow user Stoive's code snippet: * http://stackoverflow.com/q/4998908 */ /* global define, Uint8Array, ArrayBuffer, module */ ;(function(window) { 'use strict' var CanvasPrototype = window.HTMLCanvasElement && window.HTMLCanvasElement.prototype var hasBlobConstructor = window.Blob && (function() { try { return Boolean(new Blob()) } catch (e) { return false } })() var hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && (function() { try { return new Blob([new Uint8Array(100)]).size === 100 } catch (e) { return false } })() var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder var dataURIPattern = /^data:((.*?)(;charset=.*?)?)(;base64)?,/ var dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array && function(dataURI) { var matches, mediaType, isBase64, dataString, byteString, arrayBuffer, intArray, i, bb // Parse the dataURI components as per RFC 2397 matches = dataURI.match(dataURIPattern) if (!matches) { throw new Error('invalid data URI') } // Default to text/plain;charset=US-ASCII mediaType = matches[2] ? matches[1] : 'text/plain' + (matches[3] || ';charset=US-ASCII') isBase64 = !!matches[4] dataString = dataURI.slice(matches[0].length) if (isBase64) { // Convert base64 to raw binary data held in a string: byteString = atob(dataString) } else { // Convert base64/URLEncoded data component to raw binary: byteString = decodeURIComponent(dataString) } // Write the bytes of the string to an ArrayBuffer: arrayBuffer = new ArrayBuffer(byteString.length) intArray = new Uint8Array(arrayBuffer) for (i = 0; i < byteString.length; i += 1) { intArray[i] = byteString.charCodeAt(i) } // Write the ArrayBuffer (or ArrayBufferView) to a blob: if (hasBlobConstructor) { return new Blob([hasArrayBufferViewSupport ? intArray : arrayBuffer], { type: mediaType }) } bb = new BlobBuilder() bb.append(arrayBuffer) return bb.getBlob(mediaType) } if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) { if (CanvasPrototype.mozGetAsFile) { CanvasPrototype.toBlob = function(callback, type, quality) { var self = this setTimeout(function() { if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) { callback(dataURLtoBlob(self.toDataURL(type, quality))) } else { callback(self.mozGetAsFile('blob', type)) } }) } } else if (CanvasPrototype.toDataURL && dataURLtoBlob) { CanvasPrototype.toBlob = function(callback, type, quality) { var self = this setTimeout(function() { callback(dataURLtoBlob(self.toDataURL(type, quality))) }) } } } if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return dataURLtoBlob }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else {} })(window) /***/ }), /***/ "214f": /***/ (function(module, exports, __webpack_require__) { "use strict"; __webpack_require__("b0c5"); var redefine = __webpack_require__("2aba"); var hide = __webpack_require__("32e9"); var fails = __webpack_require__("79e5"); var defined = __webpack_require__("be13"); var wks = __webpack_require__("2b4c"); var regexpExec = __webpack_require__("520a"); var SPECIES = wks('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { // #replace needs built-in support for named groups. // #match works fine because it just return the exec results, even if it has // a "grops" property. var re = /./; re.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(re, '$<a>') !== '7'; }); var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec var re = /(?:)/; var originalExec = re.exec; re.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re); return result.length === 2 && result[0] === 'a' && result[1] === 'b'; })(); module.exports = function (KEY, length, exec) { var SYMBOL = wks(KEY); var DELEGATES_TO_SYMBOL = !fails(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; if (KEY === 'split') { // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; re.constructor[SPECIES] = function () { return re; }; } re[SYMBOL](''); return !execCalled; }) : undefined; if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) ) { var nativeRegExpMethod = /./[SYMBOL]; var fns = exec( defined, SYMBOL, ''[KEY], function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { if (regexp.exec === regexpExec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. // We avoid it by directly calling the native @@method method. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; } return { done: true, value: nativeMethod.call(str, regexp, arg2) }; } return { done: false }; } ); var strfn = fns[0]; var rxfn = fns[1]; redefine(String.prototype, KEY, strfn); hide(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function (string, arg) { return rxfn.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function (string) { return rxfn.call(string, this); } ); } }; /***/ }), /***/ "230e": /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__("d3f4"); var document = __webpack_require__("7726").document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /***/ "23c6": /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__("2d95"); var TAG = __webpack_require__("2b4c")('toStringTag'); // ES3 wrong here var ARG = cof(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (e) { /* empty */ } }; module.exports = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /***/ "27ee": /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__("23c6"); var ITERATOR = __webpack_require__("2b4c")('iterator'); var Iterators = __webpack_require__("84f2"); module.exports = __webpack_require__("8378").getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /***/ "28a5": /***/ (function(module, exports, __webpack_require__) { "use strict"; var isRegExp = __webpack_require__("aae3"); var anObject = __webpack_require__("cb7c"); var speciesConstructor = __webpack_require__("ebd6"); var advanceStringIndex = __webpack_require__("0390"); var toLength = __webpack_require__("9def"); var callRegExpExec = __webpack_require__("5f1b"); var regexpExec = __webpack_require__("520a"); var fails = __webpack_require__("79e5"); var $min = Math.min; var $push = [].push; var $SPLIT = 'split'; var LENGTH = 'length'; var LAST_INDEX = 'lastIndex'; var MAX_UINT32 = 0xffffffff; // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError var SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); }); // @@split logic __webpack_require__("214f")('split', 2, function (defined, SPLIT, $split, maybeCallNative) { var internalSplit; if ( 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH] ) { // based on es5-shim implementation, need to rework it internalSplit = function (separator, limit) { var string = String(this); if (separator === undefined && limit === 0) return []; // If `separator` is not a regex, use native split if (!isRegExp(separator)) return $split.call(string, separator, limit); var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var match, lastIndex, lastLength; while (match = regexpExec.call(separatorCopy, string)) { lastIndex = separatorCopy[LAST_INDEX]; if (lastIndex > lastLastIndex) { output.push(string.slice(lastLastIndex, match.index)); if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); lastLength = match[0][LENGTH]; lastLastIndex = lastIndex; if (output[LENGTH] >= splitLimit) break; } if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop } if (lastLastIndex === string[LENGTH]) { if (lastLength || !separatorCopy.test('')) output.push(''); } else output.push(string.slice(lastLastIndex)); return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; }; // Chakra, V8 } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { internalSplit = function (separator, limit) { return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit); }; } else { internalSplit = $split; } return [ // `String.prototype.split` method // https://tc39.github.io/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = defined(this); var splitter = separator == undefined ? undefined : separator[SPLIT]; return splitter !== undefined ? splitter.call(separator, O, limit) : internalSplit.call(String(O), separator, limit); }, // `RegExp.prototype[@@split]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split // // NOTE: This cannot be properly polyfilled in engines that don't support // the 'y' flag. function (regexp, limit) { var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); var C = speciesConstructor(rx, RegExp); var unicodeMatching = rx.unicode; var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; var p = 0; var q = 0; var A = []; while (q < S.length) { splitter.lastIndex = SUPPORTS_Y ? q : 0; var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); var e; if ( z === null || (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { A.push(S.slice(p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { A.push(z[i]); if (A.length === lim) return A; } q = p = e; } } A.push(S.slice(p)); return A; } ]; }); /***/ }), /***/ "2aba": /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__("7726"); var hide = __webpack_require__("32e9"); var has = __webpack_require__("69a8"); var SRC = __webpack_require__("ca5a")('src'); var $toString = __webpack_require__("fa5b"); var TO_STRING = 'toString'; var TPL = ('' + $toString).split(TO_STRING); __webpack_require__("8378").inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) has(val, 'name') || hide(val, 'name', key); if (O[key] === val) return; if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === global) { O[key] = val; } else if (!safe) { delete O[key]; hide(O, key, val); } else if (O[key]) { O[key] = val; } else { hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }), /***/ "2aeb": /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__("cb7c"); var dPs = __webpack_require__("1495"); var enumBugKeys = __webpack_require__("e11e"); var IE_PROTO = __webpack_require__("613b")('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__("230e")('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; __webpack_require__("fab2").appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /***/ "2af9": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return install; }); /* harmony import */ var _ImageUploader_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("324b"); /*! * vue-image-upload-resize * Based on ImageUploader (c) Ross Turner (https://github.com/rossturner/HTML5-ImageUploader) * Adapted by (c) 2018 Svale Fossåskaret (http://kartoteket.as/team/svale.html / @Fossesvale) * @license MIT. */ // Import vue component // Declare install function executed by Vue.use() function install(Vue) { if (install.installed) return; install.installed = true; Vue.component('ImageUploader', _ImageUploader_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]); } // Create module definition for Vue.use() var plugin = { install: install }; // Auto-install when vue is found (eg. in browser via <script> tag) var GlobalVue = null; if (typeof window !== 'undefined') { GlobalVue = window.Vue; } else if (typeof global !== 'undefined') { GlobalVue = global.Vue; } if (GlobalVue) { GlobalVue.use(plugin); } // Inject install function into component - allows component // to be registered via Vue.use() as well as Vue.component() _ImageUploader_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].install = install; // To allow use as module (npm/webpack/etc.) export component /* harmony default export */ __webpack_exports__["a"] = (_ImageUploader_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba"))) /***/ }), /***/ "2b4c": /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__("5537")('wks'); var uid = __webpack_require__("ca5a"); var Symbol = __webpack_require__("7726").Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /***/ "2d00": /***/ (function(module, exports) { module.exports = false; /***/ }), /***/ "2d95": /***/ (function(module, exports) { var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; /***/ }), /***/ "2fdb": /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.7 String.prototype.includes(searchString, position = 0) var $export = __webpack_require__("5ca1"); var context = __webpack_require__("d2c8"); var INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__("5147")(INCLUDES), 'String', { includes: function includes(searchString /* , position = 0 */) { return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /***/ "324b": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4e78570d-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/ImageUploader.vue?vue&type=template&id=76138d4a& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('img',{directives:[{name:"show",rawName:"v-show",value:(_vm.imagePreview),expression:"imagePreview"}],staticClass:"img-preview",attrs:{"src":_vm.imagePreview,"width":"400"}}),_c('input',{class:_vm.className,attrs:{"id":_vm.id,"type":"file","accept":_vm.accept,"capture":_vm.capture},on:{"change":_vm.uploadFile}}),_vm._t("upload-label")],2)} var staticRenderFns = [] // CONCATENATED MODULE: ./src/components/ImageUploader.vue?vue&type=template&id=76138d4a& // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.function.name.js var es6_function_name = __webpack_require__("7f7f"); // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js var web_dom_iterable = __webpack_require__("ac6a"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.iterator.js var es6_array_iterator = __webpack_require__("cadf"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.keys.js var es6_object_keys = __webpack_require__("456d"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js var es7_array_includes = __webpack_require__("6762"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js var es6_string_includes = __webpack_require__("2fdb"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.split.js var es6_regexp_split = __webpack_require__("28a5"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.number.constructor.js var es6_number_constructor = __webpack_require__("c5f6"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.typed.uint8-array.js var es6_typed_uint8_array = __webpack_require__("34ef"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.replace.js var es6_regexp_replace = __webpack_require__("a481"); // CONCATENATED MODULE: ./src/utils/exif.js /** Adapted and simplified from https://github.com/exif-js/exif-js MIT License (c) Jacob Seidelin https://github.com/exif-js/exif-js/blob/master/LICENSE.md */ var debug = false; var ExifTags = { // version tags 0x9000: 'ExifVersion', // EXIF version 0xa000: 'FlashpixVersion', // Flashpix format version // colorspace tags 0xa001: 'ColorSpace', // Color space information tag // image configuration 0xa002: 'PixelXDimension', // Valid width of meaningful image 0xa003: 'PixelYDimension', // Valid height of meaningful image 0x9101: 'ComponentsConfiguration', // Information about channels 0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel // user information 0x927c: 'MakerNote', // Any desired information written by the manufacturer 0x9286: 'UserComment', // Comments by user // related file 0xa004: 'RelatedSoundFile', // Name of related sound file // date and time 0x9003: 'DateTimeOriginal', // Date and time when the original image was generated 0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally 0x9290: 'SubsecTime', // Fractions of seconds for DateTime 0x9291: 'SubsecTimeOriginal', // Fractions of seconds for DateTimeOriginal 0x9292: 'SubsecTimeDigitized', // Fractions of seconds for DateTimeDigitized // picture-taking conditions 0x829a: 'ExposureTime', // Exposure time (in seconds) 0x829d: 'FNumber', // F number 0x8822: 'ExposureProgram', // Exposure program 0x8824: 'SpectralSensitivity', // Spectral sensitivity 0x8827: 'ISOSpeedRatings', // ISO speed rating 0x8828: 'OECF', // Optoelectric conversion factor 0x9201: 'ShutterSpeedValue', // Shutter speed 0x9202: 'ApertureValue', // Lens aperture 0x9203: 'BrightnessValue', // Value of brightness 0x9204: 'ExposureBias', // Exposure bias 0x9205: 'MaxApertureValue', // Smallest F number of lens 0x9206: 'SubjectDistance', // Distance to subject in meters 0x9207: 'MeteringMode', // Metering mode 0x9208: 'LightSource', // Kind of light source 0x9209: 'Flash', // Flash status 0x9214: 'SubjectArea', // Location and area of main subject 0x920a: 'FocalLength', // Focal length of the lens in mm 0xa20b: 'FlashEnergy', // Strobe energy in BCPS 0xa20c: 'SpatialFrequencyResponse', // 0xa20e: 'FocalPlaneXResolution', // Number of pixels in width direction per FocalPlaneResolutionUnit 0xa20f: 'FocalPlaneYResolution', // Number of pixels in height direction per FocalPlaneResolutionUnit 0xa210: 'FocalPlaneResolutionUnit', // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution 0xa214: 'SubjectLocation', // Location of subject in image 0xa215: 'ExposureIndex', // Exposure index selected on camera 0xa217: 'SensingMethod', // Image sensor type 0xa300: 'FileSource', // Image source (3 == DSC) 0xa301: 'SceneType', // Scene type (1 == directly photographed) 0xa302: 'CFAPattern', // Color filter array geometric pattern 0xa401: 'CustomRendered', // Special processing 0xa402: 'ExposureMode', // Exposure mode 0xa403: 'WhiteBalance', // 1 = auto white balance, 2 = manual 0xa404: 'DigitalZoomRation', // Digital zoom ratio 0xa405: 'FocalLengthIn35mmFilm', // Equivalent foacl length assuming 35mm film camera (in mm) 0xa406: 'SceneCaptureType', // Type of scene 0xa407: 'GainControl', // Degree of overall image gain adjustment 0xa408: 'Contrast', // Direction of contrast processing applied by camera 0xa409: 'Saturation', // Direction of saturation processing applied by camera 0xa40a: 'Sharpness', // Direction of sharpness processing applied by camera 0xa40b: 'DeviceSettingDescription', // 0xa40c: 'SubjectDistanceRange', // Distance to subject // other tags 0xa005: 'InteroperabilityIFDPointer', 0xa420: 'ImageUniqueID' // Identifier assigned uniquely to each image }; var TiffTags = { 0x0100: 'ImageWidth', 0x0101: 'ImageHeight', 0x8769: 'ExifIFDPointer', 0x8825: 'GPSInfoIFDPointer', 0xa005: 'InteroperabilityIFDPointer', 0x0102: 'BitsPerSample', 0x0103: 'Compression', 0x0106: 'PhotometricInterpretation', 0x0112: 'Orientation', 0x0115: 'SamplesPerPixel', 0x011c: 'PlanarConfiguration', 0x0212: 'YCbCrSubSampling', 0x0213: 'YCbCrPositioning', 0x011a: 'XResolution', 0x011b: 'YResolution', 0x0128: 'ResolutionUnit', 0x0111: 'StripOffsets', 0x0116: 'RowsPerStrip', 0x0117: 'StripByteCounts', 0x0201: 'JPEGInterchangeFormat', 0x0202: 'JPEGInterchangeFormatLength', 0x012d: 'TransferFunction', 0x013e: 'WhitePoint', 0x013f: 'PrimaryChromaticities', 0x0211: 'YCbCrCoefficients', 0x0214: 'ReferenceBlackWhite', 0x0132: 'DateTime', 0x010e: 'ImageDescription', 0x010f: 'Make', 0x0110: 'Model', 0x0131: 'Software', 0x013b: 'Artist', 0x8298: 'Copyright' }; var GPSTags = { 0x0000: 'GPSVersionID', 0x0001: 'GPSLatitudeRef', 0x0002: 'GPSLatitude', 0x0003: 'GPSLongitudeRef', 0x0004: 'GPSLongitude', 0x0005: 'GPSAltitudeRef', 0x0006: 'GPSAltitude', 0x0007: 'GPSTimeStamp', 0x0008: 'GPSSatellites', 0x0009: 'GPSStatus', 0x000a: 'GPSMeasureMode', 0x000b: 'GPSDOP', 0x000c: 'GPSSpeedRef', 0x000d: 'GPSSpeed', 0x000e: 'GPSTrackRef', 0x000f: 'GPSTrack', 0x0010: 'GPSImgDirectionRef', 0x0011: 'GPSImgDirection', 0x0012: 'GPSMapDatum', 0x0013: 'GPSDestLatitudeRef', 0x0014: 'GPSDestLatitude', 0x0015: 'GPSDestLongitudeRef', 0x0016: 'GPSDestLongitude', 0x0017: 'GPSDestBearingRef', 0x0018: 'GPSDestBearing', 0x0019: 'GPSDestDistanceRef', 0x001a: 'GPSDestDistance', 0x001b: 'GPSProcessingMethod', 0x001c: 'GPSAreaInformation', 0x001d: 'GPSDateStamp', 0x001e: 'GPSDifferential' }; // EXIF 2.3 Spec var IFD1Tags = { 0x0100: 'ImageWidth', 0x0101: 'ImageHeight', 0x0102: 'BitsPerSample', 0x0103: 'Compression', 0x0106: 'PhotometricInterpretation', 0x0111: 'StripOffsets', 0x0112: 'Orientation', 0x0115: 'SamplesPerPixel', 0x0116: 'RowsPerStrip', 0x0117: 'StripByteCounts', 0x011a: 'XResolution', 0x011b: 'YResolution', 0x011c: 'PlanarConfiguration', 0x0128: 'ResolutionUnit', 0x0201: 'JpegIFOffset', // When image format is JPEG, this value show offset to JPEG data stored.(aka "ThumbnailOffset" or "JPEGInterchangeFormat") 0x0202: 'JpegIFByteCount', // When image format is JPEG, this value shows data size of JPEG image (aka "ThumbnailLength" or "JPEGInterchangeFormatLength") 0x0211: 'YCbCrCoefficients', 0x0212: 'YCbCrSubSampling', 0x0213: 'YCbCrPositioning', 0x0214: 'ReferenceBlackWhite' }; var 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: { 0x0000: 'Flash did not fire', 0x0001: 'Flash fired', 0x0005: 'Strobe return light not detected', 0x0007: 'Strobe return light detected', 0x0009: 'Flash fired, compulsory flash mode', 0x000d: 'Flash fired, compulsory flash mode, return light not detected', 0x000f: 'Flash fired, compulsory flash mode, return light detected', 0x0010: 'Flash did not fire, compulsory flash mode', 0x0018: 'Flash did not fire, auto mode', 0x0019: 'Flash fired, auto mode', 0x001d: 'Flash fired, auto mode, return light not detected', 0x001f: 'Flash fired, auto mode, return light detected', 0x0020: 'No flash function', 0x0041: 'Flash fired, red-eye reduction mode', 0x0045: 'Flash fired, red-eye reduction mode, return light not detected', 0x0047: 'Flash fired, red-eye reduction mode, return light detected', 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode', 0x004d: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected', 0x004f: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected', 0x0059: 'Flash fired, auto mode, red-eye reduction mode', 0x005d: 'Flash fired, auto mode, return light not detected, red-eye reduction mode', 0x005f: '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' } }; var IptcFieldMap = { 0x78: 'caption', 0x6e: 'credit', 0x19: 'keywords', 0x37: 'dateCreated', 0x50: 'byline', 0x55: 'bylineTitle', 0x7a: 'captionWriter', 0x69: 'headline', 0x74: 'copyright', 0x0f: 'category' }; function imageHasData(img) { return !!img.exifdata; } function base64ToArrayBuffer(base64) { base64 = base64.replace(/^data:([^;]+);base64,/gim, ''); var binary = atob(base64); var len = binary.length; var buffer = new ArrayBuffer(len); var view = new Uint8Array(buffer); for (var i = 0; i < len; i++) { view[i] = binary.charCodeAt(i); } return buffer; } function objectURLToBlob(url, callback) { var http = new XMLHttpRequest(); http.open('GET', url, true); http.responseType = 'blob'; http.onload = function () { if (this.status == 200 || this.status === 0) { callback(this.response); } }; http.send(); } function getImageData(img, callback) { function handleBinaryFile(binFile) { var data = findEXIFinJPEG(binFile); img.exifdata = data || {}; var iptcdata = findIPTCinJPEG(binFile); img.iptcdata = iptcdata || {}; if (callback) { callback.call(img); } } if (img.src) { if (/^data:/i.test(img.src)) { // Data URI var arrayBuffer = base64ToArrayBuffer(img.src); handleBinaryFile(arrayBuffer); } else if (/^blob:/i.test(img.src)) { // Object URL var fileReader = new FileReader(); fileReader.onload = function (e) { handleBinaryFile(e.target.result); }; objectURLToBlob(img.src, function (blob) { fileReader.readAsArrayBuffer(blob); }); } else { var http = new XMLHttpRequest(); http.onload = function () { if (this.status == 200 || this.status === 0) { handleBinaryFile(http.response); } else { throw 'Could not load image'; } http = null; }; http.open('GET', img.src, true); http.responseType = 'arraybuffer'; http.send(null); } } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) { fileReader = new FileReader(); fileReader.onload = function (e) { // eslint-disable-next-line if (debug) console.log('Got file of length ' + e.target.result.byteLength); handleBinaryFile(e.target.result); }; fileReader.readAsArrayBuffer(img); } } function findEXIFinJPEG(file) { var dataView = new DataView(file); // eslint-disable-next-line if (debug) console.log('Got file of length ' + file.byteLength); if (dataView.getUint8(0) != 0xff || dataView.getUint8(1) != 0xd8) { // eslint-disable-next-line if (debug) console.log('Not a valid JPEG'); return false; // not a valid jpeg } var offset = 2, length = file.byteLength, marker; while (offset < length) { if (dataView.getUint8(offset) != 0xff) { // eslint-disable-next-line if (debug) console.log('Not a valid marker at offset ' + offset + ', found: ' + dataView.getUint8(offset)); return false; // not a valid marker, something is wrong } marker = dataView.getUint8(offset + 1); // eslint-disable-next-line if (debug) console.log(marker); // we could implement handling for other markers here, // but we're only looking for 0xFFE1 for EXIF data if (marker == 225) { // eslint-disable-next-line if (debug) console.log('Found 0xFFE1 marker'); return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2); // offset += 2 + file.getShortAt(offset+2, true); } else { offset += 2 + dataView.getUint16(offset + 2); } } } function findIPTCinJPEG(file) { var dataView = new DataView(file); // eslint-disable-next-line if (debug) console.log('Got file of length ' + file.byteLength); if (dataView.getUint8(0) != 0xff || dataView.getUint8(1) != 0xd8) { // eslint-disable-next-line if (debug) console.log('Not a valid JPEG'); return false; // not a valid jpeg } var offset = 2, length = file.byteLength; var isFieldSegmentStart = function isFieldSegmentStart(dataView, offset) { return dataView.getUint8(offset) === 0x38 && dataView.getUint8(offset + 1) === 0x42 && dataView.getUint8(offset + 2) === 0x49 && dataView.getUint8(offset + 3) === 0x4d && dataView.getUint8(offset + 4) === 0x04 && dataView.getUint8(offset + 5) =