1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Supporting date before epoch (1970) #245, #294

This commit is contained in:
Patrik J. Braun 2021-05-24 14:56:23 +02:00
parent 8e9fc45928
commit 466496650e
6 changed files with 65 additions and 4 deletions

View File

@ -199,15 +199,21 @@ export class MetadataLoader {
if (iptcData.caption) {
metadata.caption = iptcData.caption.replace(/\0/g, '').trim();
}
metadata.keywords = iptcData.keywords || [];
if (Array.isArray(iptcData.keywords)) {
metadata.keywords = iptcData.keywords;
}
metadata.creationDate = ((iptcData.date_time ? iptcData.date_time.getTime() : metadata.creationDate) as number);
if (iptcData.date_time) {
metadata.creationDate = iptcData.date_time.getTime();
}
} catch (err) {
// Logger.debug(LOG_TAG, 'Error parsing iptc data', fullPath, err);
}
metadata.creationDate = Math.max(metadata.creationDate || 0, 0);
if (!metadata.creationDate) { // creationDate can be negative, when it was created before epoch (1970)
metadata.creationDate = 0;
}
try {
// TODO: clean up the three different exif readers,

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,46 @@
{
"cameraData": {
"ISO": 800,
"exposure": 0.008,
"fStop": 5.6,
"focalLength": 85,
"lens": "EF-S15-85mm f/3.5-5.6 IS USM",
"make": "Canon",
"model": "Canon EOS 600D"
},
"caption": "Bambi Caption",
"creationDate": -11630935227000,
"faces": [
{
"box": {
"height": 2,
"left": 4,
"top": 2,
"width": 2
},
"name": "Bambi"
}
],
"fileSize": 19145,
"keywords": [
"USA",
"USA Road trip",
"Yosemite"
],
"orientation": 1,
"positionData": {
"GPSData": {
"altitude": 1960,
"latitude": 37.74805833333333,
"longitude": -119.51402333333333
},
"city": "Yosemite Nemzeti Park",
"country": "United States",
"state": "California"
},
"rating": 2,
"size": {
"height": 7,
"width": 10
}
}

View File

@ -7,7 +7,7 @@
"make": "NIKON",
"model": "E880"
},
"creationDate": 0,
"creationDate": -2211753600000,
"fileSize": 72850,
"orientation": 1,
"size": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,9 @@
{
"creationDate": 1621859678578,
"fileSize": 5860,
"orientation": 1,
"size": {
"height": 7,
"width": 10
}
}