image simplification

This commit is contained in:
Violet Caulfield
2025-02-18 21:49:42 -06:00
parent 9813d2fbe7
commit 965b473bd0
2 changed files with 5 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ import { getImageApi } from "@jellyfin/sdk/lib/utils/api"
import _ from "lodash"
import Client from "../../../api/client"
export function fetchItemImage(itemId: string, imageType: ImageType, width: number, height: number) {
export function fetchItemImage(itemId: string, imageType: ImageType) {
return new Promise<string>(async (resolve, reject) => {
@@ -16,9 +16,9 @@ export function fetchItemImage(itemId: string, imageType: ImageType, width: numb
.getItemImage({
itemId,
imageType,
width: Math.ceil(width / 100) * 100 * 2, // Round to the nearest 100 for simplicity and to avoid
height: Math.ceil(height / 100) * 100 * 2, // redundant images in storage, then double it to make sure it's crispy
format: ImageFormat.Png
width: 1000, // We just care about one big nice image
height: 1000, // to keep in cache to use for all instants of
format: ImageFormat.Png // the image
},
{
responseType: 'blob',

View File

@@ -30,10 +30,8 @@ export default function BlurhashedImage({
QueryKeys.ItemImage,
item.AlbumId ? item.AlbumId : item.Id!,
type ?? ImageType.Primary,
Math.ceil(width / 100) * 100, // Images are fetched at a higher, generic resolution
Math.ceil(height ?? width / 100) * 100 // So these keys need to match
],
queryFn: () => fetchItemImage(item.AlbumId ? item.AlbumId : item.Id!, type ?? ImageType.Primary, width, height ?? width),
queryFn: () => fetchItemImage(item.AlbumId ? item.AlbumId : item.Id!, type ?? ImageType.Primary),
});
const blurhash = !isEmpty(item.ImageBlurHashes)