update image sizing

This commit is contained in:
Luke Pulverenti 2015-11-12 14:49:19 -05:00
parent cdfdfde8f3
commit b420c4bd8f

View File

@ -1259,7 +1259,7 @@
if (item.ImageTags.Primary) { if (item.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
width: downloadWidth, maxWidth: downloadWidth,
tag: item.ImageTags.Primary, tag: item.ImageTags.Primary,
type: "Primary", type: "Primary",
index: 0, index: 0,
@ -1271,7 +1271,7 @@
imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, { imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary", type: "Primary",
width: downloadWidth, maxWidth: downloadWidth,
tag: item.AlbumPrimaryImageTag, tag: item.AlbumPrimaryImageTag,
minScale: minScale minScale: minScale
}); });
@ -1281,7 +1281,7 @@
imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, { imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, {
type: "Primary", type: "Primary",
width: downloadWidth, maxWidth: downloadWidth,
tag: item.SeriesPrimaryImageTag, tag: item.SeriesPrimaryImageTag,
minScale: minScale minScale: minScale
}); });
@ -1291,7 +1291,7 @@
imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, { imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary", type: "Primary",
width: downloadWidth, maxWidth: downloadWidth,
tag: item.ParentPrimaryImageTag, tag: item.ParentPrimaryImageTag,
minScale: minScale minScale: minScale
}); });
@ -1467,7 +1467,7 @@
supportsAddingToCollection: function (item) { supportsAddingToCollection: function (item) {
var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'Episode', 'TvChannel', 'Program']; var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'Episode', 'TvChannel', 'Program', 'MusicAlbum'];
return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo'; return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo';
}, },
@ -1712,6 +1712,8 @@
var dateText; var dateText;
var allowImageStretching = !(Dashboard.lastSystemInfo && Dashboard.lastSystemInfo.ImageEnhancers && Dashboard.lastSystemInfo.ImageEnhancers.length);
for (var i = 0, length = items.length; i < length; i++) { for (var i = 0, length = items.length; i < length; i++) {
var item = items[i]; var item = items[i];
@ -1748,13 +1750,13 @@
} }
} }
html += LibraryBrowser.getPosterViewItemHtml(item, i, options, primaryImageAspectRatio, thumbWidth, posterWidth, squareSize, bannerWidth); html += LibraryBrowser.getPosterViewItemHtml(item, i, options, primaryImageAspectRatio, thumbWidth, posterWidth, squareSize, bannerWidth, allowImageStretching);
} }
return html; return html;
}, },
getPosterViewItemHtml: function (item, index, options, primaryImageAspectRatio, thumbWidth, posterWidth, squareSize, bannerWidth) { getPosterViewItemHtml: function (item, index, options, primaryImageAspectRatio, thumbWidth, posterWidth, squareSize, bannerWidth, allowImageStretching) {
var html = ''; var html = '';
var imgUrl = null; var imgUrl = null;
@ -1773,6 +1775,7 @@
} }
var showTitle = options.showTitle == 'auto' ? true : options.showTitle; var showTitle = options.showTitle == 'auto' ? true : options.showTitle;
var coverImage = options.coverImage;
if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.5) { if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.5) {
@ -1781,11 +1784,14 @@
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getImageUrl(item.Id, {
type: "Primary", type: "Primary",
height: height, maxHeight: height,
width: width, maxWidth: width,
tag: item.ImageTags.Primary, tag: item.ImageTags.Primary,
enableImageEnhancers: enableImageEnhancers enableImageEnhancers: enableImageEnhancers
}); });
if (height != null) {
coverImage = true;
}
} else if (options.autoThumb && item.ImageTags && item.ImageTags.Thumb) { } else if (options.autoThumb && item.ImageTags && item.ImageTags.Thumb) {
@ -1858,18 +1864,20 @@
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getImageUrl(item.Id, {
type: "Primary", type: "Primary",
height: height, maxHeight: height,
width: width, maxWidth: width,
tag: item.ImageTags.Primary, tag: item.ImageTags.Primary,
enableImageEnhancers: enableImageEnhancers enableImageEnhancers: enableImageEnhancers
}); });
if (height != null) {
coverImage = true;
}
} }
else if (item.ParentPrimaryImageTag) { else if (item.ParentPrimaryImageTag) {
imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, { imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary", type: "Primary",
width: posterWidth, maxWidth: posterWidth,
tag: item.ParentPrimaryImageTag, tag: item.ParentPrimaryImageTag,
enableImageEnhancers: enableImageEnhancers enableImageEnhancers: enableImageEnhancers
}); });
@ -1881,12 +1889,14 @@
imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, { imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary", type: "Primary",
height: height, maxHeight: height,
width: width, maxWidth: width,
tag: item.AlbumPrimaryImageTag, tag: item.AlbumPrimaryImageTag,
enableImageEnhancers: enableImageEnhancers enableImageEnhancers: enableImageEnhancers
}); });
if (width != null) {
coverImage = true;
}
} }
else if (item.Type == 'Season' && item.ImageTags && item.ImageTags.Thumb) { else if (item.Type == 'Season' && item.ImageTags && item.ImageTags.Thumb) {
@ -2005,7 +2015,12 @@
if (icon) { if (icon) {
imageCssClass += " iconCardImage"; imageCssClass += " iconCardImage";
} }
if (options.coverImage) {
if (coverImage && !options.coverImage && !allowImageStretching) {
coverImage = false;
}
if (coverImage) {
imageCssClass += " coveredCardImage"; imageCssClass += " coveredCardImage";
} }
if (options.centerImage) { if (options.centerImage) {
@ -3043,7 +3058,7 @@
url = ApiClient.getScaledImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Thumb", type: "Thumb",
height: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
shape = 'thumb'; shape = 'thumb';
@ -3052,7 +3067,7 @@
url = ApiClient.getScaledImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Primary", type: "Primary",
height: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Primary tag: item.ImageTags.Primary
}); });
detectRatio = true; detectRatio = true;
@ -3061,7 +3076,7 @@
url = ApiClient.getScaledImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Backdrop", type: "Backdrop",
height: imageHeight, maxHeight: imageHeight,
tag: item.BackdropImageTags[0] tag: item.BackdropImageTags[0]
}); });
shape = 'thumb'; shape = 'thumb';
@ -3070,7 +3085,7 @@
url = ApiClient.getScaledImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Thumb", type: "Thumb",
height: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
shape = 'thumb'; shape = 'thumb';
@ -3079,7 +3094,7 @@
url = ApiClient.getScaledImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Disc", type: "Disc",
height: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Disc tag: item.ImageTags.Disc
}); });
shape = 'square'; shape = 'square';
@ -3088,7 +3103,7 @@
url = ApiClient.getScaledImageUrl(item.AlbumId, { url = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary", type: "Primary",
height: imageHeight, maxHeight: imageHeight,
tag: item.AlbumPrimaryImageTag tag: item.AlbumPrimaryImageTag
}); });
shape = 'square'; shape = 'square';