Extracting interesting stuff from exif
This commit is contained in:
parent
f52191966c
commit
5333e8053b
|
@ -91,20 +91,35 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
|
|||
reader.addEventListener(
|
||||
'load',
|
||||
async () => {
|
||||
// this will then display a text gpxfile
|
||||
const tags = ExifReader.load(reader.result);
|
||||
const tags = ExifReader.load(reader.result, { expanded: true });
|
||||
const exif = tags.exif;
|
||||
const dateSegments = exif?.DateTimeOriginal?.value[0].split(' ');
|
||||
const date = `${dateSegments[0].replaceAll(':', '-')}T${
|
||||
dateSegments[1]
|
||||
}.${exif?.SubSecTimeOriginal?.value[0] || '0'}${
|
||||
exif?.OffsetTimeOriginal?.value[0]
|
||||
}`;
|
||||
const id = exif?.ImageUniqueID?.value[0];
|
||||
const gps = tags.gps;
|
||||
const thumbnail = tags.Thumbnail;
|
||||
const thumbnailSrc = `data:${thumbnail?.type};base64,${thumbnail?.base64}`;
|
||||
console.log({
|
||||
caller: 'ImportSingleFile / Jpeg',
|
||||
file,
|
||||
type: file.type,
|
||||
result: reader.result,
|
||||
tags,
|
||||
date,
|
||||
id,
|
||||
gps,
|
||||
thumbnailSrc,
|
||||
});
|
||||
//parseGpx(reader.result);
|
||||
},
|
||||
false
|
||||
);
|
||||
} else {
|
||||
// GPX
|
||||
reader.readAsText(file);
|
||||
reader.addEventListener(
|
||||
'load',
|
||||
|
|
Loading…
Reference in New Issue