Skip to content

Commit

Permalink
fix(web): aspect ratio for photos with Rotate 270 CW orientation (imm…
Browse files Browse the repository at this point in the history
…ich-app#3003)

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

* Remove checks assuming we can have only numeric values

* Remove the -90 value check for the orientation

* Add comment to numeric values of the orientation tag
  • Loading branch information
brighteyed authored Jun 28, 2023
1 parent add5219 commit 86562f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 1 addition & 7 deletions web/src/lib/components/assets/thumbnail/thumbnail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/utils/asset-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down

0 comments on commit 86562f2

Please sign in to comment.