Skip to content

Commit 03e8dbf

Browse files
Run comparison on images for orientation
Switch classes based on width and height
1 parent e460515 commit 03e8dbf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

plugins/archive/app/view/views/theatre.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Material } from '../../../../directives/material';
1818
[hidden]="object.container_guid == object.owner_guid || !object.album_children_guids || object.album_children_guids.length <= 1">
1919
keyboard_arrow_left
2020
</i>
21-
<div class="minds-archive-stage" *ngIf="object.subtype == 'image'">
21+
<div class="minds-archive-stage" [ngClass]="{minds-image-landscape: orientation == 'landscape', minds-image-portrait: orientation == 'portrait'}" *ngIf="object.subtype == 'image'">
2222
<img src="/archive/thumbnail/{{object.guid}}/xlarge"/>
2323
</div>
2424
<div class="minds-archive-stage" *ngIf="object.subtype == 'video'">
@@ -44,6 +44,7 @@ import { Material } from '../../../../directives/material';
4444
export class ArchiveTheatre {
4545

4646
object: any = {};
47+
orientation: string;
4748
session = SessionFactory.build();
4849

4950
constructor(public client: Client, public router: Router){
@@ -53,6 +54,14 @@ export class ArchiveTheatre {
5354
if(!value.guid)
5455
return;
5556
this.object = value;
57+
if(this.object.subtype == 'image'){
58+
/*Check image's aspect ratio for landscape or l*/
59+
if(this.object.naturalWidth >= this.object.naturalHeight){
60+
this.orientation = 'landscape';
61+
} else {
62+
this.orientation = 'portrait';
63+
}
64+
}
5665
}
5766

5867
prev(){

0 commit comments

Comments
 (0)