mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
parent
8e9fc45928
commit
466496650e
@ -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,
|
||||
|
BIN
test/backend/assets/edge_case_exif_data/before_epoch.jpg
Normal file
BIN
test/backend/assets/edge_case_exif_data/before_epoch.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
46
test/backend/assets/edge_case_exif_data/before_epoch.json
Normal file
46
test/backend/assets/edge_case_exif_data/before_epoch.json
Normal 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
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
"make": "NIKON",
|
||||
"model": "E880"
|
||||
},
|
||||
"creationDate": 0,
|
||||
"creationDate": -2211753600000,
|
||||
"fileSize": 72850,
|
||||
"orientation": 1,
|
||||
"size": {
|
||||
|
BIN
test/backend/assets/edge_case_exif_data/no_metadata.jpg
Normal file
BIN
test/backend/assets/edge_case_exif_data/no_metadata.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
9
test/backend/assets/edge_case_exif_data/no_metadata.json
Normal file
9
test/backend/assets/edge_case_exif_data/no_metadata.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"creationDate": 1621859678578,
|
||||
"fileSize": 5860,
|
||||
"orientation": 1,
|
||||
"size": {
|
||||
"height": 7,
|
||||
"width": 10
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user