Repository navigation
Posters asked for ?w= come smaller for every kind of title, not only games - #199
Draft
wittywilla wants to merge 1 commit into
Draft
wittywilla wants to merge 1 commit into
wittywilla wants to merge 1 commit into
Conversation
…games A grid asks for each poster at a few hundred pixels; films, episodes, music and the rest got the file beside the media instead, 1.6 MB for one of the demo posters. The small copies are the games' ones: made once, kept in the image cache, two at a time at most (each decode can hold 128 MB), and now trimmed to 512 MB with the other caches. Closes #178 Refs #89 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #178
Refs #89
What changes
GET /api/items/{id}/poster?w=…now makes a smaller copy for every kind of title. Before, only games got one; films, episodes, music, books and the rest got the original file whateverwsaid.GameMeta.PosterThumb), unchanged in what it accepts: only acache:picture or a picture inside a library folder (Store.LibraryFile), never a remote address, only up to 640 px, snapped to the thumbnail widths, decoded only after its header says it's a picture of at most 16 megapixels. The serving path after it is the sameserveArtSrc, so the picture rules (no SVG, sandboxed) still apply.trimCachetakes a name prefix now, and onlygamethumb-files count.gamethumb-names, so the games' copies already made stay in use.The web app doesn't ask with
?w=yet (posterUrlin web/src/api.ts and music'scoverUrl): that's #90's, noted for that chat in the shared notes. Until then this changes what the server can do, not what the web app gets. Lists that already ask withw(collections, the video gallery, games) get it now for every kind.Numbers
Demo media (
D:\WittyDemoMedia) scanned byscripts/perf(#89's benchmark), same data folder, base build then this one, Windows, busy machine:?w=300?w=300Making a copy took 0.15 to 1.3 s the first time on that busy machine, then it's a file read (15 to 120 ms there).
How it was tested
TestPosterAskedSmallerIsSmaller(internal/server): a 1000×1500 film poster asked?w=300comes back as a 320×480 JPEG (410 KiB → 47 KiB for the noisy test picture), withoutwas the original, and a poster outside the library's folders stays 404 both ways.GOWORK=off go test ./internal/library -run 'PosterThumb|Trim|Cache'and the new server test on Windows: ok.go veton both packages.internal/serverrun (CI does it; it takes about ten minutes).Not tried
Changelog line
Posters asked for at a smaller size are made smaller for films, shows, music and books too, not only games, so lists load much less (one demo poster went from 1.6 MB to 25 KB).
🤖 Generated with Claude Code