1.4 KiB
1.4 KiB
title, tags
| title | tags | |||
|---|---|---|---|---|
| Media Utilities |
|
Media Utilities
[!info] File:
react_frontend/src/lib/media-utils.ts
Frontend utility functions for resolving image URLs and formatting display data.
Image URL Resolution
The resolution priority for all image functions:
- Local selected media —
isSelected = truein Media records - TMDB fallback — entry's
poster_path/banner_pathfrom TMDB - Default placeholder — fallback image
getPosterUrl(entry)
Returns the best poster URL for an entry.
getBackdropUrl(entry)
Returns the best backdrop URL for an entry.
getCollectionPosterUrl(collection)
getCollectionBackdropUrl(collection)
Same pattern for Collections.
getProfileUrl(profilePath)
TMDB profile image at w185 size. Used for People cards.
getTmdbPosterUrl(path, size?)
Direct TMDB image URL construction. Default size: w500.
Formatting
formatRuntime(minutes)
Converts minutes to human-readable: 142 → 2h 22m
formatDate(dateString)
Formats date strings for display.
TMDB Image Sizes
| Type | Sizes Used |
|---|---|
| Posters | w342, w500, w780 |
| Backdrops | w780, w1280 |
| Stills | w300, w1280 |
| Profiles | w185 |
Base URL: https://image.tmdb.org/t/p/
See Also
- Media System — Backend image storage and serving
- TMDB Integration — External image API