Adding more properties to picture imports

This commit is contained in:
Eric van der Vlist 2023-04-22 21:17:43 +02:00
parent 06b2c60a4a
commit 65abffb5d9
1 changed files with 16 additions and 13 deletions

View File

@ -118,19 +118,10 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
const id = exifObj.Exif[piexif.ExifIFD.ImageUniqueID];
const gps = getGps(exifObj);
const date = getDate(exifObj);
const [downsizedUrl, thumbnailUrl] = await downsize(
const [downsizedUrl, bigThumbnailUrl, thumbnailUrl] = await downsize(
reader.result,
[1024, 128]
[1024, 512, 128]
);
// const gps = tags.gps;
// const image = await Image.load(reader.result);
// const thumbnail = image.resize({
// width: 256,
// interpolation: 'bilinear',
// });
// const thumbnailUrl = thumbnail.toDataURL();
// // const thumbnail = tags.Thumbnail;
// //const thumbnailUrl = `data:${thumbnail?.type};base64,${thumbnail?.base64}`;
console.log({
caller: 'ImportSingleFile / Jpeg',
file,
@ -141,7 +132,14 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
result: reader.result,
exifObj,
});
setPicture({ id, gps, date, thumbnailUrl });
setPicture({
id,
gps,
date,
thumbnailUrl,
bigThumbnailUrl,
downsizedUrl,
});
},
false
);
@ -273,7 +271,12 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
</CardActions>
</Show>
<Show when={picture() !== undefined}>
<img src={picture()?.thumbnailUrl} />
<img src={picture()?.bigThumbnailUrl} />
<p>Id: {picture()?.id}</p>
<p>Date: {picture()?.date.toString()}</p>
<p>
Coordinates: {picture()?.gps.latitude}, {picture()?.gps.longitude}
</p>
<CardActions>
<Button
variant='contained'