Skip to content
ustclugPublic

About

Yet Another Thumbnail indEX

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

yatex

Yet Another Thumbnail indEX

Service

Accepts GET requests in this format:

/path/to/image.jpg@<width>w[_<height>h][_<quality>q][.<format>]

The width is required. The height, quality, and output format are optional. If omitted, the quality defaults to the first configured quality and the output format defaults to the source format. Dimensions, qualities, and formats must be allowed by the configuration or the service returns HTTP 404. PNG output does not accept a quality argument.

Generated filenames always include the output format and, except for PNG, the effective quality. With output_prefix: /.yatex and the example configuration, requests resolve as follows:

/images/photo.jpg@640w                    -> /.yatex/images/photo.jpg@640w_80q.jpg
/images/photo.jpg@640w_480h_75q.webp      -> /.yatex/images/photo.jpg@640w_480h_75q.webp
/images/logo.png@640w                     -> /.yatex/images/logo.png@640w.png

The service saves the generated file and returns its path in X-Accel-Redirect, allowing Nginx to serve it directly. If the source already satisfies the requested dimensions, the generated file is a symlink. Generated files cannot be used as sources for further thumbnail requests.

At most concurrency different thumbnails are generated at once. If concurrency is omitted or zero, it defaults to 1. Concurrent requests for the same generated filename share one generation operation.

When max_pixels is positive, the service reads source image metadata before decoding and rejects the image with HTTP 413 if its width multiplied by its height exceeds the limit. If max_pixels is omitted or zero, source image size remains unlimited.

The service rejects source files that report a size of zero before reading image metadata or decoding the image. When max_file_size is positive, it also rejects source files larger than that number of bytes with HTTP 413. If max_file_size is omitted or zero, only the upper-bound check is skipped.

About

Yet Another Thumbnail indEX

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages