1
0
Fork 0

exif fixes

This commit is contained in:
Matthias Kretschmann 2018-09-12 22:36:50 +02:00
parent 5d5e8dc3a5
commit 184078231f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 5 additions and 10 deletions

View File

@ -4,6 +4,7 @@ const yaml = require('js-yaml')
const { createFilePath } = require('gatsby-source-filesystem')
const { paginate } = require('gatsby-awesome-pagination')
const fastExif = require('fast-exif')
const { Fraction } = require('fractional')
const meta = yaml.load(fs.readFileSync('./content/meta.yml', 'utf8'))
const { itemsPerPage } = meta
@ -60,11 +61,6 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
}
}
const getFraction = decimal => {
for (var denominator = 1; (decimal * denominator) % 1 !== 0; denominator++);
return { numerator: decimal * denominator, denominator: denominator }
}
const generateExif = (exifData, createNodeField, node) => {
const { Model } = exifData.image
const {
@ -75,14 +71,13 @@ const generateExif = (exifData, createNodeField, node) => {
ExposureBiasValue
} = exifData.exif
const shutterspeedNumerator = getFraction(ExposureTime).numerator
const shutterspeedDenominator = getFraction(ExposureTime).denominator
const { numerator, denominator } = new Fraction(ExposureTime)
const exposureShortened = parseFloat(ExposureBiasValue.toFixed(2))
const model = Model
const model = `${Model}`
const iso = `ISO ${ISO}`
const fstop = `ƒ ${FNumber}`
const shutterspeed = `${shutterspeedNumerator}/${shutterspeedDenominator}s`
const shutterspeed = `${numerator}/${denominator}s`
const focalLength = `${FocalLength}mm`
let exposure

View File

@ -23,6 +23,7 @@
],
"dependencies": {
"fast-exif": "^1.0.1",
"fractional": "^1.0.0",
"gatsby": "^2.0.0-rc.21",
"gatsby-awesome-pagination": "^0.1.1",
"gatsby-image": "^2.0.0-rc.2",

View File

@ -36,7 +36,6 @@
/////////////////////////////////////
.type {
margin-bottom: $spacer / 2;
text-align: center;
a {