Skip to content

Commit

Permalink
Enable Exif Writers to return a new ArrayBuffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Jun 20, 2020
1 parent af40950 commit fecacd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/load-image-exif.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
}

loadImage.writeExifData = function (buffer, data, id, value) {
loadImage.exifWriters[data.exif.map[id]](buffer, data, value)
return loadImage.exifWriters[data.exif.map[id]](buffer, data, value)
}

loadImage.ExifMap = ExifMap
Expand Down
18 changes: 16 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,14 @@
expect(data.iptc).to.be.ok
expect(data.iptc.get('ObjectName')).to.equal('blueimp.net')
// Reset EXIF Orientation data:
loadImage.writeExifData(data.imageHead, data, 'Orientation', 1)
var buffer = loadImage.writeExifData(
data.imageHead,
data,
'Orientation',
1
)
// Check if Orientation writer changes image head buffer in place:
expect(buffer).to.equal(data.imageHead)
img.toBlob(function (blob) {
loadImage.replaceHead(blob, data.imageHead, function (newBlob) {
loadImage(
Expand Down Expand Up @@ -2703,7 +2710,14 @@
expect(data.iptc).to.be.ok
expect(data.iptc.get('ObjectName')).to.equal('blueimp.net')
// Reset EXIF Orientation data:
loadImage.writeExifData(data.imageHead, data, 'Orientation', 1)
var buffer = loadImage.writeExifData(
data.imageHead,
data,
'Orientation',
1
)
// Check if Orientation writer changes image head buffer in place:
expect(buffer).to.equal(data.imageHead)
return new Promise(function (resolve) {
data.image.toBlob(function (blob) {
data.blob = blob
Expand Down

0 comments on commit fecacd4

Please sign in to comment.