Skip to content

Commit 4c79652

Browse files
committed
Fix IE10 ArrayBuffer.slice workaround.
To use imageHead as DataView argument (e.g. for writing EXIF data), it needs to be a buffer.
1 parent 8776ebe commit 4c79652

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

js/load-image-meta.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
var markerLength
9797
var parsers
9898
var i
99+
var arr1
100+
var arr2
99101
// Check for the JPEG marker (0xffd8):
100102
if (dataView.getUint16(0) === 0xffd8) {
101103
while (offset < maxOffset) {
@@ -144,9 +146,12 @@
144146
if (buffer.slice) {
145147
data.imageHead = buffer.slice(0, headLength)
146148
} else {
147-
// Workaround for IE10, which does not yet
148-
// support ArrayBuffer.slice:
149-
data.imageHead = new Uint8Array(buffer).subarray(0, headLength)
149+
// Workaround for IE10, which does not support
150+
// ArrayBuffer.slice:
151+
arr1 = new Uint8Array(buffer, 0, headLength)
152+
arr2 = new Uint8Array(headLength)
153+
arr2.set(arr1)
154+
data.imageHead = arr2.buffer
150155
}
151156
}
152157
} else {

0 commit comments

Comments
 (0)