We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 476766b commit 41b1437Copy full SHA for 41b1437
1 file changed
packages/integrations/image/src/metadata.ts
@@ -5,16 +5,17 @@ import { ImageMetadata, InputFormat } from './types';
5
export async function metadata(src: string): Promise<ImageMetadata | undefined> {
6
const file = await fs.readFile(src);
7
8
- const { width, height, type } = await sizeOf(file);
+ const { width, height, type, orientation } = await sizeOf(file);
9
+ const isPortrait = (orientation || 0) >= 5;
10
11
if (!width || !height || !type) {
12
return undefined;
13
}
14
15
return {
16
src,
- width,
17
- height,
+ width: isPortrait ? height : width,
18
+ height: isPortrait ? width : height,
19
format: type as InputFormat,
20
};
21
0 commit comments