diff --git a/src/components/import/ImportSingleFile.tsx b/src/components/import/ImportSingleFile.tsx index 66d0566..ef6d942 100644 --- a/src/components/import/ImportSingleFile.tsx +++ b/src/components/import/ImportSingleFile.tsx @@ -91,20 +91,35 @@ const ImportSingleFile: Component = ({ 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',