Updated the Obsidian docs-vault
This commit is contained in:
1 parent
72fd77ee01
commit
260282a0e2
36 files changed
+3497
-144
No files matched your search
@@ -0,0 +1,69 @@
|
||||
---
|
||||
title: Media Utilities
|
||||
tags:
|
||||
- frontend
|
||||
- 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:
|
||||
|
||||
1. **Local selected media** — `isSelected = true` in Media records
|
||||
2. **TMDB fallback** — entry's `poster_path` / `banner_path` from TMDB
|
||||
3. **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
|
||||
Reference in new issue
Block a user