mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-15 09:35:21 +01:00
23 lines
713 B
JavaScript
23 lines
713 B
JavaScript
//=include exif-js/exif.js
|
|
|
|
window.onload = getExif;
|
|
|
|
function getExif() {
|
|
const image = document.querySelector('.hentry__teaser img')
|
|
const imageFileName = image.getAttribute('src').split('/').slice(-1)[0]
|
|
|
|
const img = new Image() // Create new img element
|
|
img.src = `/media/${imageFileName}`
|
|
img.addEventListener('load', function () {
|
|
EXIF.getData(img, function () {
|
|
var make = EXIF.getTag(this, 'Make')
|
|
var model = EXIF.getTag(this, 'Model')
|
|
var makeAndModel = document.querySelector('.exif__make')
|
|
makeAndModel.innerHTML = `${make} ${model}`
|
|
|
|
console.log(make)
|
|
console.log(model)
|
|
})
|
|
}, false)
|
|
}
|