From e7f0b7951da963933cf6d85c9dc9922af70a5c23 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 12 Oct 2022 23:18:34 +0200 Subject: [PATCH] fix photo upload with exif-rotated photos --- src/util.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index 0cace32..917f6df 100644 --- a/src/util.ts +++ b/src/util.ts @@ -18,7 +18,10 @@ export async function getSize(file: string): Promise { `The ${file} doesn't have width and height... how did we get there?`, ); } - return `${metadata.width}x${metadata.height}`; + const orientation = metadata.orientation ? metadata.orientation : 1; + return orientation <= 4 + ? `${metadata.width}x${metadata.height}` + : `${metadata.height}x${metadata.width}`; } export async function getShotDate(file: string): Promise {