Use strict equal when comparing exif values
This fixes a problem where flash values of 0 (no flash) would not show up in the side bar
This commit is contained in:
parent
1193222f92
commit
da664c7766
|
@ -150,53 +150,53 @@ const exposurePrograms = {
|
||||||
|
|
||||||
// From https://exiftool.org/TagNames/EXIF.html#Flash
|
// From https://exiftool.org/TagNames/EXIF.html#Flash
|
||||||
const flash = {
|
const flash = {
|
||||||
0x0: 'No Flash',
|
0x0: 'No Flash',
|
||||||
0x1: 'Fired',
|
0x1: 'Fired',
|
||||||
0x5: 'Fired, Return not detected',
|
0x5: 'Fired, Return not detected',
|
||||||
0x7: 'Fired, Return detected',
|
0x7: 'Fired, Return detected',
|
||||||
0x8: 'On, Did not fire',
|
0x8: 'On, Did not fire',
|
||||||
0x9: 'On, Fired',
|
0x9: 'On, Fired',
|
||||||
0xd: 'On, Return not detected',
|
0xd: 'On, Return not detected',
|
||||||
0xf: 'On, Return detected',
|
0xf: 'On, Return detected',
|
||||||
0x10: 'Off, Did not fire',
|
0x10: 'Off, Did not fire',
|
||||||
0x14: 'Off, Did not fire, Return not detected',
|
0x14: 'Off, Did not fire, Return not detected',
|
||||||
0x18: 'Auto, Did not fire',
|
0x18: 'Auto, Did not fire',
|
||||||
0x19: 'Auto, Fired',
|
0x19: 'Auto, Fired',
|
||||||
0x1d: 'Auto, Fired, Return not detected',
|
0x1d: 'Auto, Fired, Return not detected',
|
||||||
0x1f: 'Auto, Fired, Return detected',
|
0x1f: 'Auto, Fired, Return detected',
|
||||||
0x20: 'No flash function',
|
0x20: 'No flash function',
|
||||||
0x30: 'Off, No flash function',
|
0x30: 'Off, No flash function',
|
||||||
0x41: 'Fired, Red-eye reduction',
|
0x41: 'Fired, Red-eye reduction',
|
||||||
0x45: 'Fired, Red-eye reduction, Return not detected',
|
0x45: 'Fired, Red-eye reduction, Return not detected',
|
||||||
0x47: 'Fired, Red-eye reduction, Return detected',
|
0x47: 'Fired, Red-eye reduction, Return detected',
|
||||||
0x49: 'On, Red-eye reduction',
|
0x49: 'On, Red-eye reduction',
|
||||||
0x4d: 'On, Red-eye reduction, Return not detected',
|
0x4d: 'On, Red-eye reduction, Return not detected',
|
||||||
0x4f: 'On, Red-eye reduction, Return detected',
|
0x4f: 'On, Red-eye reduction, Return detected',
|
||||||
0x50: 'Off, Red-eye reduction',
|
0x50: 'Off, Red-eye reduction',
|
||||||
0x58: 'Auto, Did not fire, Red-eye reduction',
|
0x58: 'Auto, Did not fire, Red-eye reduction',
|
||||||
0x59: 'Auto, Fired, Red-eye reduction',
|
0x59: 'Auto, Fired, Red-eye reduction',
|
||||||
0x5d: 'Auto, Fired, Red-eye reduction, Return not detected',
|
0x5d: 'Auto, Fired, Red-eye reduction, Return not detected',
|
||||||
0x5f: 'Auto, Fired, Red-eye reduction, Return detected',
|
0x5f: 'Auto, Fired, Red-eye reduction, Return detected',
|
||||||
}
|
}
|
||||||
|
|
||||||
// From https://exiftool.org/TagNames/EXIF.html
|
// From https://exiftool.org/TagNames/EXIF.html
|
||||||
const orientation = {
|
// const orientation = {
|
||||||
1: 'Horizontal (normal)',
|
// 1: 'Horizontal (normal)',
|
||||||
2: 'Mirror horizontal',
|
// 2: 'Mirror horizontal',
|
||||||
3: 'Rotate 180',
|
// 3: 'Rotate 180',
|
||||||
4: 'Mirror vertical',
|
// 4: 'Mirror vertical',
|
||||||
5: 'Mirror horizontal and rotate 270 CW',
|
// 5: 'Mirror horizontal and rotate 270 CW',
|
||||||
6: 'Rotate 90 CW',
|
// 6: 'Rotate 90 CW',
|
||||||
7: 'Mirror horizontal and rotate 90 CW',
|
// 7: 'Mirror horizontal and rotate 90 CW',
|
||||||
8: 'Rotate 270 CW',
|
// 8: 'Rotate 270 CW',
|
||||||
}
|
// }
|
||||||
|
|
||||||
const SidebarContent = ({ media, hidePreview }) => {
|
const SidebarContent = ({ media, hidePreview }) => {
|
||||||
let exifItems = []
|
let exifItems = []
|
||||||
|
|
||||||
if (media && media.exif) {
|
if (media && media.exif) {
|
||||||
let exifKeys = Object.keys(exifNameLookup).filter(
|
let exifKeys = Object.keys(exifNameLookup).filter(
|
||||||
x => !!media.exif[x] && x != '__typename'
|
x => media.exif[x] !== undefined && x != '__typename'
|
||||||
)
|
)
|
||||||
|
|
||||||
let exif = exifKeys.reduce(
|
let exif = exifKeys.reduce(
|
||||||
|
@ -209,20 +209,23 @@ const SidebarContent = ({ media, hidePreview }) => {
|
||||||
|
|
||||||
exif.dateShot = new Date(exif.dateShot).toLocaleString()
|
exif.dateShot = new Date(exif.dateShot).toLocaleString()
|
||||||
|
|
||||||
if (exposurePrograms.hasOwnProperty(exif.exposureProgram))
|
if (
|
||||||
{
|
exif.exposureProgram !== undefined &&
|
||||||
|
exif.exposureProgram !== 0 &&
|
||||||
|
exposurePrograms[exif.exposureProgram]
|
||||||
|
) {
|
||||||
exif.exposureProgram = exposurePrograms[exif.exposureProgram]
|
exif.exposureProgram = exposurePrograms[exif.exposureProgram]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exif.aperture) {
|
if (exif.aperture !== undefined) {
|
||||||
exif.aperture = `f/${exif.aperture}`
|
exif.aperture = `f/${exif.aperture}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exif.focalLength) {
|
if (exif.focalLength !== undefined) {
|
||||||
exif.focalLength = `${exif.focalLength}mm`
|
exif.focalLength = `${exif.focalLength}mm`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flash.hasOwnProperty(exif.flash)) {
|
if (exif.flash !== undefined && flash[exif.flash]) {
|
||||||
exif.flash = flash[exif.flash]
|
exif.flash = flash[exif.flash]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue