Clean up image import a bit
This commit is contained in:
parent
8c29b8fa85
commit
4a478b2442
@ -78,7 +78,7 @@ class ImageSpec extends TypeSpec {
|
||||
|
||||
const processImportables = backgroundTask(async function _processImportables(image) {
|
||||
const { _id, _rev, sizes, digest } = image;
|
||||
const imageData = await FileType.getFromURL(image.sizes.full);
|
||||
const imageData = await FileType.getFromURL(sizes.full);
|
||||
|
||||
const img = new Image();
|
||||
const imageProps = await new Promise(resolve => {
|
||||
@ -93,19 +93,14 @@ const processImportables = backgroundTask(async function _processImportables(ima
|
||||
const ExifParser = await import('exif-parser');
|
||||
const buffer = await blobToArrayBuffer(imageData);
|
||||
|
||||
try {
|
||||
const exifData = ExifParser.create(buffer).parse();
|
||||
const { tags } = exifData;
|
||||
const originalDate = new Date(
|
||||
tags.DateTimeOriginal
|
||||
? new Date(tags.DateTimeOriginal * 1000).toISOString()
|
||||
: image.originalDate
|
||||
tags.DateTimeOriginal ? new Date(tags.DateTimeOriginal * 1000).toISOString() : image.originalDate
|
||||
).toISOString();
|
||||
|
||||
deepAssign(imageProps, {
|
||||
originalDate,
|
||||
width,
|
||||
height,
|
||||
orientation: tags.Orientation,
|
||||
digest,
|
||||
make: tags.Make,
|
||||
@ -120,9 +115,6 @@ const processImportables = backgroundTask(async function _processImportables(ima
|
||||
heading: tags.GPSImgDirection
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
|
||||
delete image.importing;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user