Round every image size adjustment

This commit is contained in:
MrTimscampi 2020-03-09 21:02:08 +01:00
parent f24c908412
commit 0397283599
4 changed files with 23 additions and 23 deletions

View File

@ -636,7 +636,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
getNowPlayingImageUrl: function (item) {
if (item && item.BackdropImageTags && item.BackdropImageTags.length) {
return ApiClient.getScaledImageUrl(item.Id, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Backdrop",
tag: item.BackdropImageTags[0]
});
@ -644,7 +644,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
return ApiClient.getScaledImageUrl(item.ParentBackdropItemId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Backdrop",
tag: item.ParentBackdropImageTags[0]
});
@ -652,7 +652,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.BackdropImageTag) {
return ApiClient.getScaledImageUrl(item.BackdropItemId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Backdrop",
tag: item.BackdropImageTag
});
@ -662,7 +662,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && imageTags.Thumb) {
return ApiClient.getScaledImageUrl(item.Id, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Thumb",
tag: imageTags.Thumb
});
@ -670,7 +670,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.ParentThumbImageTag) {
return ApiClient.getScaledImageUrl(item.ParentThumbItemId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Thumb",
tag: item.ParentThumbImageTag
});
@ -678,7 +678,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.ThumbImageTag) {
return ApiClient.getScaledImageUrl(item.ThumbItemId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Thumb",
tag: item.ThumbImageTag
});
@ -686,7 +686,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && imageTags.Primary) {
return ApiClient.getScaledImageUrl(item.Id, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary",
tag: imageTags.Primary
});
@ -694,7 +694,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.PrimaryImageTag) {
return ApiClient.getScaledImageUrl(item.PrimaryImageItemId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary",
tag: item.PrimaryImageTag
});
@ -702,7 +702,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
if (item && item.AlbumPrimaryImageTag) {
return ApiClient.getScaledImageUrl(item.AlbumId, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary",
tag: item.AlbumPrimaryImageTag
});

View File

@ -770,48 +770,48 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "userSetti
if (imageTags.Primary) {
url = apiClient.getScaledImageUrl(item.Id, {
type: "Primary",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.ImageTags.Primary
});
detectRatio = true;
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
url = apiClient.getScaledImageUrl(item.Id, {
type: "Backdrop",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.BackdropImageTags[0]
});
shape = "thumb";
} else if (imageTags.Thumb) {
url = apiClient.getScaledImageUrl(item.Id, {
type: "Thumb",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.ImageTags.Thumb
});
shape = "thumb";
} else if (imageTags.Disc) {
url = apiClient.getScaledImageUrl(item.Id, {
type: "Disc",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.ImageTags.Disc
});
shape = "square";
} else if (item.AlbumId && item.AlbumPrimaryImageTag) {
url = apiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.AlbumPrimaryImageTag
});
shape = "square";
} else if (item.SeriesId && item.SeriesPrimaryImageTag) {
url = apiClient.getScaledImageUrl(item.SeriesId, {
type: "Primary",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.SeriesPrimaryImageTag
});
} else if (item.ParentPrimaryImageItemId && item.ParentPrimaryImageTag) {
url = apiClient.getScaledImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary",
maxWidth: dom.getScreenWidth() * 0.5,
maxWidth: Math.round(dom.getScreenWidth() * 0.5),
tag: item.ParentPrimaryImageTag
});
}

View File

@ -256,7 +256,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl
if (virtualFolder.PrimaryImageItemId) {
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
maxWidth: dom.getScreenWidth() * 0.40,
maxWidth: Math.round(dom.getScreenWidth() * 0.40),
type: "Primary"
});
}

View File

@ -334,24 +334,24 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
if (item) {
var imgUrl = seriesImageUrl(item, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary"
}) || seriesImageUrl(item, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Thumb"
}) || imageUrl(item, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary"
});
if (!imgUrl && secondaryItem && (imgUrl = seriesImageUrl(secondaryItem, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary"
}) || seriesImageUrl(secondaryItem, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Thumb"
}) || imageUrl(secondaryItem, {
maxWidth: dom.getScreenWidth() * 0.20,
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
type: "Primary"
})), imgUrl) {
return void (osdPoster.innerHTML = '<img src="' + imgUrl + '" />');