Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(frontend:files): keep aspect ratio for images with large width (#4)

tibs8ac398a795b0
diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
index b9444ae7..619fc542 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
@@ -16,8 +16,8 @@
<div class="modal-body">
@switch (currentFile.shortMime) {
@case ('image') {
- <div class="d-flex justify-content-center bg-black">
- <img [src]="currentFile.dataUrl" [style.height.px]="currentHeight" alt="" class="img-fluid align-self-center">
+ <div class="d-flex justify-content-center bg-black" [style.height.px]="currentHeight">
+ <img [src]="currentFile.dataUrl" [style.max-height.px]="currentHeight" alt="" class="img-fluid align-self-center">
</div>
}
@case ('pdf') {
diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.html b/frontend/src/app/applications/files/components/sidebar/files-selection.component.html
index fc23ebde..cc0af73f 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.html
+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.html
@@ -32,7 +32,9 @@
<div class="card-body align-self-center p-0 my-1">
@switch (f.shortMime) {
@case ('image') {
- <img src="{{f.thumbnailUrl}}?size=256" alt="" class="img-fluid" [style.height.px]="cardImageSize">
+ <div class="d-flex align-items-center" [style.height.px]="cardImageSize">
+ <img src="{{f.thumbnailUrl}}?size=256" alt="" class="img-fluid" [style.max-height.px]="cardImageSize">
+ </div>
}
@case ('media') {
<app-files-viewer-media [currentHeight]="cardImageSize" [fileUrl]="f.dataUrl"></app-files-viewer-media>