/* * JavaScript Load Image IPTC Map * https://github.com/blueimp/JavaScript-Load-Image * * Copyright 2013, Sebastian Tschan * Copyright 2018, Dave Bevan * * IPTC tags mapping based on * https://iptc.org/standards/photo-metadata * https://exiftool.org/TagNames/IPTC.html * * Licensed under the MIT license: * https://opensource.org/licenses/MIT */ /* global define, module, require */ ;(function (factory) { 'use strict' if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: define(['./load-image', './load-image-iptc'], factory) } else if (typeof module === 'object' && module.exports) { factory(require('./load-image'), require('./load-image-iptc')) } else { // Browser globals: factory(window.loadImage) } })(function (loadImage) { 'use strict' var IptcMapProto = loadImage.IptcMap.prototype IptcMapProto.tags = { 0: 'ApplicationRecordVersion', 3: 'ObjectTypeReference', 4: 'ObjectAttributeReference', 5: 'ObjectName', 7: 'EditStatus', 8: 'EditorialUpdate', 10: 'Urgency', 12: 'SubjectReference', 15: 'Category', 20: 'SupplementalCategories', 22: 'FixtureIdentifier', 25: 'Keywords', 26: 'ContentLocationCode', 27: 'ContentLocationName', 30: 'ReleaseDate', 35: 'ReleaseTime', 37: 'ExpirationDate', 38: 'ExpirationTime', 40: 'SpecialInstructions', 42: 'ActionAdvised', 45: 'ReferenceService', 47: 'ReferenceDate', 50: 'ReferenceNumber', 55: 'DateCreated', 60: 'TimeCreated', 62: 'DigitalCreationDate', 63: 'DigitalCreationTime', 65: 'OriginatingProgram', 70: 'ProgramVersion', 75: 'ObjectCycle', 80: 'Byline', 85: 'BylineTitle', 90: 'City', 92: 'Sublocation', 95: 'State', 100: 'CountryCode', 101: 'Country', 103: 'OriginalTransmissionReference', 105: 'Headline', 110: 'Credit', 115: 'Source', 116: 'CopyrightNotice', 118: 'Contact', 120: 'Caption', 121: 'LocalCaption', 122: 'Writer', 125: 'RasterizedCaption', 130: 'ImageType', 131: 'ImageOrientation', 135: 'LanguageIdentifier', 150: 'AudioType', 151: 'AudioSamplingRate', 152: 'AudioSamplingResolution', 153: 'AudioDuration', 154: 'AudioOutcue', 184: 'JobID', 185: 'MasterDocumentID', 186: 'ShortDocumentID', 187: 'UniqueDocumentID', 188: 'OwnerID', 200: 'ObjectPreviewFileFormat', 201: 'ObjectPreviewFileVersion', 202: 'ObjectPreviewData', 221: 'Prefs', 225: 'ClassifyState', 228: 'SimilarityIndex', 230: 'DocumentNotes', 231: 'DocumentHistory', 232: 'ExifCameraInfo', 255: 'CatalogSets' } IptcMapProto.stringValues = { 10: { 0: '0 (reserved)', 1: '1 (most urgent)', 2: '2', 3: '3', 4: '4', 5: '5 (normal urgency)', 6: '6', 7: '7', 8: '8 (least urgent)', 9: '9 (user-defined priority)' }, 75: { a: 'Morning', b: 'Both Morning and Evening', p: 'Evening' }, 131: { L: 'Landscape', P: 'Portrait', S: 'Square' } } IptcMapProto.getText = function (id) { var value = this.get(id) var tagCode = this.map[id] var stringValue = this.stringValues[tagCode] if (stringValue) return stringValue[value] return String(value) } IptcMapProto.getAll = function () { var map = {} var prop var name for (prop in this) { if (Object.prototype.hasOwnProperty.call(this, prop)) { name = this.tags[prop] if (name) map[name] = this.getText(name) } } return map } IptcMapProto.getName = function (tagCode) { return this.tags[tagCode] } // Extend the map of tag names to tag codes: ;(function () { var tags = IptcMapProto.tags var map = IptcMapProto.map || {} var prop // Map the tag names to tags: for (prop in tags) { if (Object.prototype.hasOwnProperty.call(tags, prop)) { map[tags[prop]] = Number(prop) } } })() })