mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-05 18:40:01 -06:00
image simplification
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user