2017-11-25 17:58:19 +01:00
|
|
|
/* global EXIF */
|
|
|
|
|
|
|
|
/* eslint-disable spaced-comment */
|
2017-11-18 21:33:56 +01:00
|
|
|
//=include exif-js/exif.js
|
2017-11-25 17:58:19 +01:00
|
|
|
/* eslint-enable spaced-comment */
|
2017-11-18 21:33:56 +01:00
|
|
|
|
2018-02-16 09:08:36 +01:00
|
|
|
window.addEventListener('load', getExif, false)
|
2017-11-18 21:33:56 +01:00
|
|
|
|
|
|
|
function getExif() {
|
|
|
|
const image = document.querySelector('.hentry__teaser img')
|
2017-11-19 14:03:24 +01:00
|
|
|
|
|
|
|
EXIF.getData(image, function () {
|
2017-11-25 17:58:19 +01:00
|
|
|
// Get individual data
|
2017-11-19 14:03:24 +01:00
|
|
|
const modelvalue = EXIF.getTag(this, 'Model')
|
|
|
|
const shutterspeedvalue = EXIF.getTag(this, 'ExposureTime')
|
|
|
|
const aperturevalue = EXIF.getTag(this, 'FNumber')
|
|
|
|
const exposurevalue = EXIF.getTag(this, 'ExposureBias')
|
|
|
|
const isovalue = EXIF.getTag(this, 'ISOSpeedRatings')
|
|
|
|
const focallengthvalue = EXIF.getTag(this, 'FocalLength')
|
|
|
|
|
2017-11-25 17:58:19 +01:00
|
|
|
// Inject data
|
2017-11-19 14:03:24 +01:00
|
|
|
if (modelvalue) {
|
|
|
|
const model = document.querySelector('.exif__model')
|
|
|
|
model.innerHTML = modelvalue
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shutterspeedvalue) {
|
|
|
|
const shutterspeed = document.querySelector('.exif__shutterspeed')
|
|
|
|
shutterspeed.innerHTML = `${shutterspeedvalue.numerator}/${shutterspeedvalue.denominator}s`
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aperturevalue) {
|
|
|
|
const aperture = document.querySelector('.exif__aperture')
|
|
|
|
aperture.innerHTML = `ƒ ${aperturevalue}`
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exposurevalue || exposurevalue === 0) {
|
|
|
|
const exposure = document.querySelector('.exif__exposure')
|
|
|
|
|
|
|
|
if (exposurevalue === 0) {
|
|
|
|
exposure.innerHTML = `+/- ${exposurevalue}`
|
|
|
|
} else if (exposurevalue > 0) {
|
|
|
|
exposure.innerHTML = `+ ${exposurevalue}`
|
|
|
|
} else {
|
|
|
|
exposure.innerHTML = `- ${exposurevalue}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isovalue) {
|
|
|
|
const iso = document.querySelector('.exif__iso')
|
|
|
|
iso.innerHTML = `ISO ${isovalue}`
|
|
|
|
}
|
|
|
|
|
|
|
|
if (focallengthvalue) {
|
|
|
|
const focallength = document.querySelector('.exif__focallength')
|
|
|
|
focallength.innerHTML = `${focallengthvalue}mm`
|
|
|
|
}
|
|
|
|
})
|
2017-11-18 21:33:56 +01:00
|
|
|
}
|