mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
36 lines
867 B
TypeScript
36 lines
867 B
TypeScript
import { Api } from "@jellyfin/sdk";
|
|
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
|
|
|
/**
|
|
* Retrieves the primary image URL for a given item.
|
|
*
|
|
* @param api - The Jellyfin API instance.
|
|
* @param item - The media item to retrieve the backdrop image URL for.
|
|
* @param quality - The desired image quality (default: 10).
|
|
*/
|
|
export const getLogoImageUrlById = ({
|
|
api,
|
|
item,
|
|
height = 130,
|
|
}: {
|
|
api?: Api | null;
|
|
item?: BaseItemDto | null;
|
|
height?: number;
|
|
}) => {
|
|
if (!api || !item) {
|
|
return null;
|
|
}
|
|
|
|
const imageTags = item.ImageTags?.["Logo"];
|
|
|
|
if (!imageTags) return null;
|
|
|
|
const params = new URLSearchParams();
|
|
|
|
params.append("tag", imageTags);
|
|
params.append("quality", "90");
|
|
params.append("fillHeight", height.toString());
|
|
|
|
return `${api.basePath}/Items/${item.Id}/Images/Logo?${params.toString()}`;
|
|
};
|