Skip to content

High performance self-hosted photo and video management solution.

fix(web): aspect ratio for photos with Rotate 270 CW orientation (#3003)

Sergey Kondrikov86562f256f71
diff --git a/web/src/lib/components/assets/thumbnail/thumbnail.svelte b/web/src/lib/components/assets/thumbnail/thumbnail.svelte
index e4b078490d..2e1ca9a357 100644
--- a/web/src/lib/components/assets/thumbnail/thumbnail.svelte
+++ b/web/src/lib/components/assets/thumbnail/thumbnail.svelte
@@ -39,13 +39,7 @@
return [thumbnailWidth, thumbnailHeight];
}
- if (asset.exifInfo?.orientation === 'Rotate 90 CW') {
- return [176, 235];
- } else if (asset.exifInfo?.orientation === 'Horizontal (normal)') {
- return [313, 235];
- } else {
- return [235, 235];
- }
+ return [235, 235];
})();
const thumbnailClickedHandler = () => {
diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts
index 1e4ad8066f..0f6c848729 100644
--- a/web/src/lib/utils/asset-utils.ts
+++ b/web/src/lib/utils/asset-utils.ts
@@ -189,7 +189,8 @@ export function getAssetRatio(asset: AssetResponseDto) {
let width = asset.exifInfo?.exifImageWidth || 235;
const orientation = Number(asset.exifInfo?.orientation);
if (orientation) {
- if (orientation == 6 || orientation == -90) {
+ // 6 - Rotate 90 CW, 8 - Rotate 270 CW
+ if (orientation == 6 || orientation == 8) {
[width, height] = [height, width];
}
}