diff --git a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.html b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.html
index 76e3127..18984fd 100644
--- a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.html
+++ b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.html
@@ -4,11 +4,13 @@
-
+
-
+
diff --git a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.scss b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.scss
index 00a5cc0..92aade4 100644
--- a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.scss
+++ b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.scss
@@ -44,6 +44,15 @@ img {
margin: auto;
}
+.align-width {
+ width: 100%;
+ height: auto;
+}
+.align-height {
+ height: 100%;
+ width: auto;
+}
+
.close-button {
position: absolute;
top: 0;
diff --git a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.ts b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.ts
index 468bc39..b241a1a 100644
--- a/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.ts
+++ b/mediarepo-ui/src/app/components/file-gallery/file-gallery.component.ts
@@ -30,6 +30,7 @@ export class FileGalleryComponent implements OnChanges, OnInit {
selectedFile: Selectable
| undefined;
fileContentUrl: SafeResourceUrl | undefined;
+ scaleWidth = false;
constructor(private fileService: FileService) {
}
@@ -131,4 +132,11 @@ export class FileGalleryComponent implements OnChanges, OnInit {
}
return undefined;
}
+
+ public adjustImageSize(fullImage: HTMLImageElement, imageContainer: HTMLDivElement): void {
+ const containerRatio = imageContainer.clientHeight / imageContainer.clientWidth;
+ const imageAdjHeight = fullImage.height / containerRatio;
+ const imageAdjWidth = fullImage.width * containerRatio;
+ this.scaleWidth = imageAdjWidth > imageAdjHeight;
+ }
}