From 74de218ff63a601ef64be74df0114c7c68815f8c Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Sun, 11 Apr 2021 12:30:06 -0400 Subject: [PATCH] Merge pull request #2514 from oddstr13/image-fill-resize Add support for fillWidth and fillHeight (cherry picked from commit 2c85b7806bc21553adecf5375a5246f1c28b3635) Signed-off-by: Joshua M. Boniface --- src/components/appRouter.js | 2 +- src/components/cardbuilder/cardBuilder.js | 4 ++-- src/components/listview/listview.js | 10 ++++++---- src/components/playback/playbackmanager.js | 2 +- src/components/slideshow/slideshow.js | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/appRouter.js b/src/components/appRouter.js index c14434180d..b5aacf5073 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -446,7 +446,7 @@ class AppRouter { normalizeImageOptions(options) { let setQuality; - if (options.maxWidth || options.width || options.maxHeight || options.height) { + if (options.maxWidth || options.width || options.maxHeight || options.height || options.fillWidth || options.fillHeight) { setQuality = true; } diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js index b34c3969a4..7b901a54cd 100644 --- a/src/components/cardbuilder/cardBuilder.js +++ b/src/components/cardbuilder/cardBuilder.js @@ -615,8 +615,8 @@ import ServerConnections from '../ServerConnections'; if (imgTag && imgType) { imgUrl = apiClient.getScaledImageUrl(itemId, { type: imgType, - maxHeight: height, - maxWidth: width, + fillHeight: height, + fillWidth: width, tag: imgTag }); } diff --git a/src/components/listview/listview.js b/src/components/listview/listview.js index 96ffcd0ad3..f25fb26c9d 100644 --- a/src/components/listview/listview.js +++ b/src/components/listview/listview.js @@ -76,12 +76,13 @@ import ServerConnections from '../ServerConnections'; return ''; } - function getImageUrl(item, width) { + function getImageUrl(item, size) { const apiClient = ServerConnections.getApiClient(item.ServerId); let itemId; const options = { - maxWidth: width, + fillWidth: size, + fillHeight: size, type: 'Primary' }; @@ -105,10 +106,11 @@ import ServerConnections from '../ServerConnections'; return null; } - function getChannelImageUrl(item, width) { + function getChannelImageUrl(item, size) { const apiClient = ServerConnections.getApiClient(item.ServerId); const options = { - maxWidth: width, + fillWidth: size, + fillHeight: size, type: 'Primary' }; diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 6d9aebdacb..9dd196448d 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -156,7 +156,7 @@ function backdropImageUrl(apiClient, item, options) { options.type = options.type || 'Backdrop'; // If not resizing, get the original image - if (!options.maxWidth && !options.width && !options.maxHeight && !options.height) { + if (!options.maxWidth && !options.width && !options.maxHeight && !options.height && !options.fillWidth && !options.fillHeight) { options.quality = 100; } diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index 0a50d26ea9..c22f9ca3ef 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -71,7 +71,7 @@ function getBackdropImageUrl(item, options, apiClient) { options.type = options.type || 'Backdrop'; // If not resizing, get the original image - if (!options.maxWidth && !options.width && !options.maxHeight && !options.height) { + if (!options.maxWidth && !options.width && !options.maxHeight && !options.height && !options.fillWidth && !options.fillHeight) { options.quality = 100; }