fix(webdav): stop the resolution ladder at 2048

The largest rung is the largest box a generator is asked for, and fill and stretch enlarge a small source to fill it, so the rungs above 2048 let a tiny image cost whatever 8K costs. Web asks for 1200 at most.
This commit is contained in:
Dominik Schmidt committed 2026-10-20 16:56:28 +02:00
1 parent 9b9b5ab6a2
commit 4e85772b47
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -30,9 +30,9 @@ The following query parameters are supported:
#### Thumbnail Resolution
`WEBDAV_THUMBNAIL_RESOLUTIONS` is a ladder of edge lengths, not a list of boxes. Each axis of a request is rounded up to the next length on the ladder, on its own, so a thumbnail never comes back in a different orientation than it was asked for. The largest length is the cap: a request above it, and an axis left unconstrained, get that one.
`WEBDAV_THUMBNAIL_RESOLUTIONS` is a ladder of edge lengths, not a list of boxes. Its largest entry is also the largest thumbnail this service asks a generator for, which is why it tops out at 2048: `fill` and `stretch` enlarge a small source to fill the box, so a higher rung lets a tiny image cost whatever that box costs. Each axis of a request is rounded up to the next length on the ladder, on its own, so a thumbnail never comes back in a different orientation than it was asked for. The largest length is the cap: a request above it, and an axis left unconstrained, get that one.
Example with the default ladder (16, 32, 64, 128, 192, 256, 320, 384, 448, 512, 640, 768, 1024, 1280, 1920, 2560, 3840, 7680):
Example with the default ladder (16, 32, 64, 128, 192, 256, 320, 384, 448, 512, 640, 768, 1024, 1280, 1920, 2048):
Requested: 18x12\
Returned: 32x16
@@ -49,7 +49,7 @@ func DefaultConfig() *config.Config {
ThumbnailCacheBackend: "file",
ThumbnailResolutions: []string{
"16", "32", "64", "128", "192", "256", "320", "384", "448",
"512", "640", "768", "1024", "1280", "1920", "2560", "3840", "7680",
"512", "640", "768", "1024", "1280", "1920", "2048",
},
}
}