Demo: Keep meta data when cropping or rotating. · blueimp/JavaScript-Load-Image@46fe1bf · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 46fe1bf

Browse files
committed
Demo: Keep meta data when cropping or rotating.
1 parent 3f20490 commit 46fe1bf

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

js/demo/demo.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,18 @@ $(function () {
120120
*
121121
* @param {*} img Image or canvas element
122122
* @param {object} [data] Metadata object
123+
* @param {boolean} [keepMetaData] Keep meta data if true
123124
*/
124-
function updateResults(img, data) {
125-
removeMetaData()
125+
function updateResults(img, data, keepMetaData) {
126+
if (!keepMetaData) {
127+
removeMetaData()
128+
if (data) {
129+
if (img.getContext) {
130+
actionsNode.show()
131+
}
132+
displayMetaData(data)
133+
}
134+
}
126135
if (!(img.src || img instanceof HTMLCanvasElement)) {
127136
resultNode
128137
.children()
@@ -131,15 +140,6 @@ $(function () {
131140
}
132141
var content = $('<a></a>').append(img)
133142
resultNode.children().replaceWith(content)
134-
if (data) {
135-
if (img.getContext) {
136-
actionsNode.show()
137-
}
138-
displayMetaData(data)
139-
} else {
140-
// eslint-disable-next-line no-param-reassign
141-
data = metaNode.data()
142-
}
143143
if (data.imageHead) {
144144
if (data.exif) {
145145
// Reset Exif Orientation data:
@@ -241,7 +241,9 @@ $(function () {
241241
pixelRatio: window.devicePixelRatio,
242242
orientation: Number(orientationNode.val()) || true,
243243
imageSmoothingEnabled: imageSmoothingNode.is(':checked')
244-
})
244+
}),
245+
metaNode.data(),
246+
true
245247
)
246248
}
247249
})
@@ -294,7 +296,9 @@ $(function () {
294296
contain: true,
295297
pixelRatio: pixelRatio,
296298
imageSmoothingEnabled: imageSmoothingNode.is(':checked')
297-
})
299+
}),
300+
metaNode.data(),
301+
true
298302
)
299303
coordinates = null
300304
}

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.