|
13 | 13 |
|
14 | 14 | /* eslint-disable no-console */ |
15 | 15 |
|
16 | | -;(function(factory) { |
| 16 | +;(function (factory) { |
17 | 17 | 'use strict' |
18 | 18 | if (typeof define === 'function' && define.amd) { |
19 | 19 | // Register as an anonymous AMD module: |
|
24 | 24 | // Browser globals: |
25 | 25 | factory(window.loadImage) |
26 | 26 | } |
27 | | -})(function(loadImage) { |
| 27 | +})(function (loadImage) { |
28 | 28 | 'use strict' |
29 | 29 |
|
30 | | - loadImage.ExifMap = function() { |
| 30 | + loadImage.ExifMap = function () { |
31 | 31 | return this |
32 | 32 | } |
33 | 33 |
|
34 | 34 | loadImage.ExifMap.prototype.map = { |
35 | 35 | Orientation: 0x0112 |
36 | 36 | } |
37 | 37 |
|
38 | | - loadImage.ExifMap.prototype.get = function(id) { |
| 38 | + loadImage.ExifMap.prototype.get = function (id) { |
39 | 39 | return this[id] || this[this.map[id]] |
40 | 40 | } |
41 | 41 |
|
42 | | - loadImage.getExifThumbnail = function(dataView, offset, length) { |
| 42 | + loadImage.getExifThumbnail = function (dataView, offset, length) { |
43 | 43 | if (!length || offset + length > dataView.byteLength) { |
44 | 44 | console.log('Invalid Exif data: Invalid thumbnail data.') |
45 | 45 | return |
|
52 | 52 | loadImage.exifTagTypes = { |
53 | 53 | // byte, 8-bit unsigned int: |
54 | 54 | 1: { |
55 | | - getValue: function(dataView, dataOffset) { |
| 55 | + getValue: function (dataView, dataOffset) { |
56 | 56 | return dataView.getUint8(dataOffset) |
57 | 57 | }, |
58 | 58 | size: 1 |
59 | 59 | }, |
60 | 60 | // ascii, 8-bit byte: |
61 | 61 | 2: { |
62 | | - getValue: function(dataView, dataOffset) { |
| 62 | + getValue: function (dataView, dataOffset) { |
63 | 63 | return String.fromCharCode(dataView.getUint8(dataOffset)) |
64 | 64 | }, |
65 | 65 | size: 1, |
66 | 66 | ascii: true |
67 | 67 | }, |
68 | 68 | // short, 16 bit int: |
69 | 69 | 3: { |
70 | | - getValue: function(dataView, dataOffset, littleEndian) { |
| 70 | + getValue: function (dataView, dataOffset, littleEndian) { |
71 | 71 | return dataView.getUint16(dataOffset, littleEndian) |
72 | 72 | }, |
73 | 73 | size: 2 |
74 | 74 | }, |
75 | 75 | // long, 32 bit int: |
76 | 76 | 4: { |
77 | | - getValue: function(dataView, dataOffset, littleEndian) { |
| 77 | + getValue: function (dataView, dataOffset, littleEndian) { |
78 | 78 | return dataView.getUint32(dataOffset, littleEndian) |
79 | 79 | }, |
80 | 80 | size: 4 |
81 | 81 | }, |
82 | 82 | // rational = two long values, first is numerator, second is denominator: |
83 | 83 | 5: { |
84 | | - getValue: function(dataView, dataOffset, littleEndian) { |
| 84 | + getValue: function (dataView, dataOffset, littleEndian) { |
85 | 85 | return ( |
86 | 86 | dataView.getUint32(dataOffset, littleEndian) / |
87 | 87 | dataView.getUint32(dataOffset + 4, littleEndian) |
|
91 | 91 | }, |
92 | 92 | // slong, 32 bit signed int: |
93 | 93 | 9: { |
94 | | - getValue: function(dataView, dataOffset, littleEndian) { |
| 94 | + getValue: function (dataView, dataOffset, littleEndian) { |
95 | 95 | return dataView.getInt32(dataOffset, littleEndian) |
96 | 96 | }, |
97 | 97 | size: 4 |
98 | 98 | }, |
99 | 99 | // srational, two slongs, first is numerator, second is denominator: |
100 | 100 | 10: { |
101 | | - getValue: function(dataView, dataOffset, littleEndian) { |
| 101 | + getValue: function (dataView, dataOffset, littleEndian) { |
102 | 102 | return ( |
103 | 103 | dataView.getInt32(dataOffset, littleEndian) / |
104 | 104 | dataView.getInt32(dataOffset + 4, littleEndian) |
|
110 | 110 | // undefined, 8-bit byte, value depending on field: |
111 | 111 | loadImage.exifTagTypes[7] = loadImage.exifTagTypes[1] |
112 | 112 |
|
113 | | - loadImage.getExifValue = function( |
| 113 | + loadImage.getExifValue = function ( |
114 | 114 | dataView, |
115 | 115 | tiffOffset, |
116 | 116 | offset, |
|
167 | 167 | return values |
168 | 168 | } |
169 | 169 |
|
170 | | - loadImage.parseExifTag = function( |
| 170 | + loadImage.parseExifTag = function ( |
171 | 171 | dataView, |
172 | 172 | tiffOffset, |
173 | 173 | offset, |
|
185 | 185 | ) |
186 | 186 | } |
187 | 187 |
|
188 | | - loadImage.parseExifTags = function( |
| 188 | + loadImage.parseExifTags = function ( |
189 | 189 | dataView, |
190 | 190 | tiffOffset, |
191 | 191 | dirOffset, |
|
216 | 216 | return dataView.getUint32(dirEndOffset, littleEndian) |
217 | 217 | } |
218 | 218 |
|
219 | | - loadImage.parseExifData = function(dataView, offset, length, data, options) { |
| 219 | + loadImage.parseExifData = function (dataView, offset, length, data, options) { |
220 | 220 | if (options.disableExif) { |
221 | 221 | return |
222 | 222 | } |
|
0 commit comments