Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

170 řádky
4.2 KiB

  1. /*
  2. * JavaScript Load Image IPTC Map
  3. * https://github.com/blueimp/JavaScript-Load-Image
  4. *
  5. * Copyright 2013, Sebastian Tschan
  6. * Copyright 2018, Dave Bevan
  7. *
  8. * IPTC tags mapping based on
  9. * https://iptc.org/standards/photo-metadata
  10. * https://exiftool.org/TagNames/IPTC.html
  11. *
  12. * Licensed under the MIT license:
  13. * https://opensource.org/licenses/MIT
  14. */
  15. /* global define, module, require */
  16. ;(function (factory) {
  17. 'use strict'
  18. if (typeof define === 'function' && define.amd) {
  19. // Register as an anonymous AMD module:
  20. define(['jquery/fileUploader/vendor/blueimp-load-image/js/load-image', 'jquery/fileUploader/vendor/blueimp-load-image/js/load-image-iptc'], factory)
  21. } else if (typeof module === 'object' && module.exports) {
  22. factory(require('jquery/fileUploader/vendor/blueimp-load-image/js/load-image'), require('jquery/fileUploader/vendor/blueimp-load-image/js/load-image-iptc'))
  23. } else {
  24. // Browser globals:
  25. factory(window.loadImage)
  26. }
  27. })(function (loadImage) {
  28. 'use strict'
  29. var IptcMapProto = loadImage.IptcMap.prototype
  30. IptcMapProto.tags = {
  31. 0: 'ApplicationRecordVersion',
  32. 3: 'ObjectTypeReference',
  33. 4: 'ObjectAttributeReference',
  34. 5: 'ObjectName',
  35. 7: 'EditStatus',
  36. 8: 'EditorialUpdate',
  37. 10: 'Urgency',
  38. 12: 'SubjectReference',
  39. 15: 'Category',
  40. 20: 'SupplementalCategories',
  41. 22: 'FixtureIdentifier',
  42. 25: 'Keywords',
  43. 26: 'ContentLocationCode',
  44. 27: 'ContentLocationName',
  45. 30: 'ReleaseDate',
  46. 35: 'ReleaseTime',
  47. 37: 'ExpirationDate',
  48. 38: 'ExpirationTime',
  49. 40: 'SpecialInstructions',
  50. 42: 'ActionAdvised',
  51. 45: 'ReferenceService',
  52. 47: 'ReferenceDate',
  53. 50: 'ReferenceNumber',
  54. 55: 'DateCreated',
  55. 60: 'TimeCreated',
  56. 62: 'DigitalCreationDate',
  57. 63: 'DigitalCreationTime',
  58. 65: 'OriginatingProgram',
  59. 70: 'ProgramVersion',
  60. 75: 'ObjectCycle',
  61. 80: 'Byline',
  62. 85: 'BylineTitle',
  63. 90: 'City',
  64. 92: 'Sublocation',
  65. 95: 'State',
  66. 100: 'CountryCode',
  67. 101: 'Country',
  68. 103: 'OriginalTransmissionReference',
  69. 105: 'Headline',
  70. 110: 'Credit',
  71. 115: 'Source',
  72. 116: 'CopyrightNotice',
  73. 118: 'Contact',
  74. 120: 'Caption',
  75. 121: 'LocalCaption',
  76. 122: 'Writer',
  77. 125: 'RasterizedCaption',
  78. 130: 'ImageType',
  79. 131: 'ImageOrientation',
  80. 135: 'LanguageIdentifier',
  81. 150: 'AudioType',
  82. 151: 'AudioSamplingRate',
  83. 152: 'AudioSamplingResolution',
  84. 153: 'AudioDuration',
  85. 154: 'AudioOutcue',
  86. 184: 'JobID',
  87. 185: 'MasterDocumentID',
  88. 186: 'ShortDocumentID',
  89. 187: 'UniqueDocumentID',
  90. 188: 'OwnerID',
  91. 200: 'ObjectPreviewFileFormat',
  92. 201: 'ObjectPreviewFileVersion',
  93. 202: 'ObjectPreviewData',
  94. 221: 'Prefs',
  95. 225: 'ClassifyState',
  96. 228: 'SimilarityIndex',
  97. 230: 'DocumentNotes',
  98. 231: 'DocumentHistory',
  99. 232: 'ExifCameraInfo',
  100. 255: 'CatalogSets'
  101. }
  102. IptcMapProto.stringValues = {
  103. 10: {
  104. 0: '0 (reserved)',
  105. 1: '1 (most urgent)',
  106. 2: '2',
  107. 3: '3',
  108. 4: '4',
  109. 5: '5 (normal urgency)',
  110. 6: '6',
  111. 7: '7',
  112. 8: '8 (least urgent)',
  113. 9: '9 (user-defined priority)'
  114. },
  115. 75: {
  116. a: 'Morning',
  117. b: 'Both Morning and Evening',
  118. p: 'Evening'
  119. },
  120. 131: {
  121. L: 'Landscape',
  122. P: 'Portrait',
  123. S: 'Square'
  124. }
  125. }
  126. IptcMapProto.getText = function (id) {
  127. var value = this.get(id)
  128. var tagCode = this.map[id]
  129. var stringValue = this.stringValues[tagCode]
  130. if (stringValue) return stringValue[value]
  131. return String(value)
  132. }
  133. IptcMapProto.getAll = function () {
  134. var map = {}
  135. var prop
  136. var name
  137. for (prop in this) {
  138. if (Object.prototype.hasOwnProperty.call(this, prop)) {
  139. name = this.tags[prop]
  140. if (name) map[name] = this.getText(name)
  141. }
  142. }
  143. return map
  144. }
  145. IptcMapProto.getName = function (tagCode) {
  146. return this.tags[tagCode]
  147. }
  148. // Extend the map of tag names to tag codes:
  149. ;(function () {
  150. var tags = IptcMapProto.tags
  151. var map = IptcMapProto.map || {}
  152. var prop
  153. // Map the tag names to tags:
  154. for (prop in tags) {
  155. if (Object.prototype.hasOwnProperty.call(tags, prop)) {
  156. map[tags[prop]] = Number(prop)
  157. }
  158. }
  159. })()
  160. })