Merge pull request #2593 from oddstr13/pr-imagefix-master

Ensure that fillHeight gets set on image requests
This commit is contained in:
Bill Thornton 2021-04-14 14:01:49 -04:00 committed by GitHub
commit 5c09077a2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 20 deletions

6
package-lock.json generated
View file

@ -5975,9 +5975,9 @@
"dev": true "dev": true
}, },
"jellyfin-apiclient": { "jellyfin-apiclient": {
"version": "1.6.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/jellyfin-apiclient/-/jellyfin-apiclient-1.6.0.tgz", "resolved": "https://registry.npmjs.org/jellyfin-apiclient/-/jellyfin-apiclient-1.7.0.tgz",
"integrity": "sha512-LL8YwUQJYTFdlx6VwA5C3+KWkLEM0V56fJGruUDwCVUCFQQVJ+E6hpHIO1lMeo26ZxURtebf5VtCCG35ZHugbg==" "integrity": "sha512-aaUmhdvox02ge/ROSc8bsdmghjvfbP1QZ28yEPHaMHzY2GBaFczcCWXvEtl6dcQW+lfkemmFtf8D4OSvLHiFzw=="
}, },
"jest-worker": { "jest-worker": {
"version": "26.6.2", "version": "26.6.2",

View file

@ -64,7 +64,7 @@
"headroom.js": "^0.12.0", "headroom.js": "^0.12.0",
"hls.js": "^0.14.17", "hls.js": "^0.14.17",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
"jellyfin-apiclient": "^1.6.0", "jellyfin-apiclient": "^1.7.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"jstree": "^3.3.11", "jstree": "^3.3.11",
"libarchive.js": "^1.3.0", "libarchive.js": "^1.3.0",

View file

@ -498,7 +498,7 @@ import ServerConnections from '../ServerConnections';
let imgUrl = null; let imgUrl = null;
let imgTag = null; let imgTag = null;
let coverImage = false; let coverImage = false;
let uiAspect = null; const uiAspect = getDesiredAspect(shape);
let imgType = null; let imgType = null;
let itemId = null; let itemId = null;
@ -543,11 +543,8 @@ import ServerConnections from '../ServerConnections';
forceName = true; forceName = true;
} }
if (primaryImageAspectRatio) { if (primaryImageAspectRatio && uiAspect) {
uiAspect = getDesiredAspect(shape); coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
if (uiAspect) {
coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
}
} }
} else if (item.SeriesPrimaryImageTag) { } else if (item.SeriesPrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
@ -563,11 +560,8 @@ import ServerConnections from '../ServerConnections';
forceName = true; forceName = true;
} }
if (primaryImageAspectRatio) { if (primaryImageAspectRatio && uiAspect) {
uiAspect = getDesiredAspect(shape); coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
if (uiAspect) {
coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
}
} }
} else if (item.ParentPrimaryImageTag) { } else if (item.ParentPrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
@ -579,11 +573,8 @@ import ServerConnections from '../ServerConnections';
itemId = item.AlbumId; itemId = item.AlbumId;
height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null; height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null;
if (primaryImageAspectRatio) { if (primaryImageAspectRatio && uiAspect) {
uiAspect = getDesiredAspect(shape); coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
if (uiAspect) {
coverImage = (Math.abs(primaryImageAspectRatio - uiAspect) / uiAspect) <= 0.2;
}
} }
} else if (item.Type === 'Season' && item.ImageTags && item.ImageTags.Thumb) { } else if (item.Type === 'Season' && item.ImageTags && item.ImageTags.Thumb) {
imgType = 'Thumb'; imgType = 'Thumb';
@ -613,10 +604,15 @@ import ServerConnections from '../ServerConnections';
} }
if (imgTag && imgType) { if (imgTag && imgType) {
// TODO: This place is a mess. Could do with a good spring cleaning.
if (!height && width && uiAspect) {
height = width / uiAspect;
}
imgUrl = apiClient.getScaledImageUrl(itemId, { imgUrl = apiClient.getScaledImageUrl(itemId, {
type: imgType, type: imgType,
fillHeight: height, fillHeight: height,
fillWidth: width, fillWidth: width,
quality: 96,
tag: imgTag tag: imgTag
}); });
} }