set lower image max height and width + fix calculation, make use of values in html.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
|
||||
var itemDefaultHeight = 200;
|
||||
var itemDefaultWidth = 200;
|
||||
var itemMaxWidth = 300;
|
||||
var itemMaxHeight = 300;
|
||||
var itemMaxWidth = 200;
|
||||
var itemMaxHeight = 200;
|
||||
|
||||
function activate() {
|
||||
|
||||
@@ -60,14 +60,18 @@
|
||||
item.aspectRatio = item.width / item.height;
|
||||
|
||||
// set max width and height
|
||||
if(item.width > itemMaxWidth) {
|
||||
item.width = itemMaxWidth;
|
||||
item.height = itemMaxWidth / item.aspectRatio;
|
||||
}
|
||||
|
||||
if(item.height > itemMaxHeight) {
|
||||
item.height = itemMaxHeight;
|
||||
item.width = itemMaxHeight * item.aspectRatio;
|
||||
// landscape
|
||||
if(item.aspectRatio >= 1) {
|
||||
if(item.width > itemMaxWidth) {
|
||||
item.width = itemMaxWidth;
|
||||
item.height = itemMaxWidth / item.aspectRatio;
|
||||
}
|
||||
// portrait
|
||||
} else {
|
||||
if(item.height > itemMaxHeight) {
|
||||
item.height = itemMaxHeight;
|
||||
item.width = itemMaxHeight * item.aspectRatio;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-media-grid__image-background" ng-if="item.thumbnail"></div>
|
||||
<img class="umb-media-grid__item-image" ng-if="item.thumbnail" ng-src="{{item.thumbnail}}" alt="{{item.name}}" />
|
||||
<img class="umb-media-grid__item-image" width="{{item.width}}" height="{{item.height}}" ng-if="item.thumbnail" ng-src="{{item.thumbnail}}" alt="{{item.name}}" />
|
||||
<img class="umb-media-grid__item-image-placeholder" ng-if="!item.thumbnail" src="assets/img/transparent.png" alt="{{item.name}}" />
|
||||
|
||||
<i class="umb-media-grid__item-icon {{ item.icon }}" ng-if="!item.thumbnail"></i>
|
||||
|
||||
Reference in New Issue
Block a user