From c16b5c40a5759c7b6fd273bf58778943b7c3daa0 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 4 Dec 2018 13:21:45 +0100 Subject: [PATCH] Fixing photo metadata error --- backend/model/threading/DiskMangerWorker.ts | 6 +++--- common/config/private/IPrivateConfig.ts | 1 + common/config/private/PrivateConfigClass.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/model/threading/DiskMangerWorker.ts b/backend/model/threading/DiskMangerWorker.ts index aa7dae15..b01d60b8 100644 --- a/backend/model/threading/DiskMangerWorker.ts +++ b/backend/model/threading/DiskMangerWorker.ts @@ -182,8 +182,8 @@ export class DiskMangerWorker { return new Promise((resolve, reject) => { const fd = fs.openSync(fullPath, 'r'); - const data = Buffer.allocUnsafe(65535); - fs.read(fd, data, 0, 65535, 0, (err) => { + const data = Buffer.allocUnsafe(Config.Server.photoMetadataSize); + fs.read(fd, data, 0, Config.Server.photoMetadataSize, 0, (err) => { // fs.readFile(fullPath, (err, data) => { if (err) { fs.closeSync(fd); @@ -234,7 +234,7 @@ export class DiskMangerWorker { metadata.orientation = exif.tags.Orientation; } - + console.log(exif); if (exif.imageSize) { metadata.size = {width: exif.imageSize.width, height: exif.imageSize.height}; } else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) { diff --git a/common/config/private/IPrivateConfig.ts b/common/config/private/IPrivateConfig.ts index c19f441f..cf936aa2 100644 --- a/common/config/private/IPrivateConfig.ts +++ b/common/config/private/IPrivateConfig.ts @@ -65,6 +65,7 @@ export interface ServerConfig { sharing: SharingConfig; sessionTimeout: number; indexing: IndexingConfig; + photoMetadataSize:number; } export interface IPrivateConfig { diff --git a/common/config/private/PrivateConfigClass.ts b/common/config/private/PrivateConfigClass.ts index fb1163dc..8031328b 100644 --- a/common/config/private/PrivateConfigClass.ts +++ b/common/config/private/PrivateConfigClass.ts @@ -17,6 +17,7 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon qualityPriority: true }, sessionTimeout: 1000 * 60 * 60 * 24 * 7, + photoMetadataSize: 512 * 1024, database: { type: DatabaseType.sqlite, mysql: {