Skip to content

Commit

Permalink
Run comparison on images for orientation
Browse files Browse the repository at this point in the history
Switch classes based on width and height
  • Loading branch information
theunknownartisthour authored Oct 20, 2016
1 parent e460515 commit 03e8dbf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/archive/app/view/views/theatre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Material } from '../../../../directives/material';
[hidden]="object.container_guid == object.owner_guid || !object.album_children_guids || object.album_children_guids.length <= 1">
keyboard_arrow_left
</i>
<div class="minds-archive-stage" *ngIf="object.subtype == 'image'">
<div class="minds-archive-stage" [ngClass]="{minds-image-landscape: orientation == 'landscape', minds-image-portrait: orientation == 'portrait'}" *ngIf="object.subtype == 'image'">
<img src="/archive/thumbnail/{{object.guid}}/xlarge"/>
</div>
<div class="minds-archive-stage" *ngIf="object.subtype == 'video'">
Expand All @@ -44,6 +44,7 @@ import { Material } from '../../../../directives/material';
export class ArchiveTheatre {

object: any = {};
orientation: string;
session = SessionFactory.build();

constructor(public client: Client, public router: Router){
Expand All @@ -53,6 +54,14 @@ export class ArchiveTheatre {
if(!value.guid)
return;
this.object = value;
if(this.object.subtype == 'image'){
/*Check image's aspect ratio for landscape or l*/
if(this.object.naturalWidth >= this.object.naturalHeight){
this.orientation = 'landscape';
} else {
this.orientation = 'portrait';
}
}
}

prev(){
Expand Down

0 comments on commit 03e8dbf

Please sign in to comment.