2021-10-29 03:17:00 +00:00
|
|
|
# kodak
|
2020-09-16 07:41:53 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
Web server for auto-generating banners, previews, thumbnails, and more from any directory.
|
|
|
|
Lightweight, simple, and designed for performance.
|
2020-09-16 07:41:53 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
Developed with [Poetry 1.0+](https://python-poetry.org/)
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
## Goals
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support defining server-side manipulation specifications
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
```
|
|
|
|
KODAK_MANIP_FOOBAR_CROP_VERTICAL=300
|
|
|
|
KODAK_MANIP_FOOBAR_SCALE_HORIZONTAL=1200
|
|
|
|
KODAK_MANIP_FOOBAR_SCALE_STRATEGY=absolute
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
KODAK_MANIP_FIZZBUZZ_NAME=black+white
|
|
|
|
KODAK_MANIP_FIZZBUZZ_BLACK_AND_WHITE=true
|
|
|
|
KODAK_MANIP_FIZZBUZZ_SCALE_HORIZONTAL=50
|
|
|
|
KODAK_MANIP_FIZZBUZZ_SCALE_STRATEGY=relative
|
|
|
|
```
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support retrieving manipulated images based on server side configuration
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
```
|
|
|
|
GET /image/<name>/foobar
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
GET /image/<name>/black+white
|
|
|
|
```
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support optionally exposing full-resolution source images
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
```
|
|
|
|
GET /image/<name>/original
|
|
|
|
```
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support caching of generated image manipulations for reuse
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support [HTTP 410](https://httpstatuses.com/410) for indicating removed images and
|
|
|
|
manipulations
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support optional authentication with pre-generated access tokens
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support static file tree management for exposure via external web server (which is faster
|
|
|
|
than serving files with python)
|
2021-05-02 22:12:04 +00:00
|
|
|
|
2021-11-14 03:49:14 +00:00
|
|
|
- Support automatic indexing of newly added image files
|
|
|
|
|
|
|
|
- Support automatic indexing of removed image files
|
|
|
|
|
|
|
|
- Support arbitrary source directory structure
|
|
|
|
|
|
|
|
- Support Dockerized deployment
|
|
|
|
|
|
|
|
- Support bare-metal deployment (via systemd)
|
|
|
|
|
|
|
|
## Non-goals
|
|
|
|
|
|
|
|
- Client-defined image manipulations through publicly exposed parameters
|
|
|
|
|
|
|
|
> Manipulating images is- in the grand scheme of things- pretty resource intensive. Exposing
|
|
|
|
> dynamic parameters that can be cycled through to generate hundreds or thousands of
|
|
|
|
> permutations for every known image on a server could be used to either consume the
|
|
|
|
> server's entire disk or server's entire CPU.
|
|
|
|
|
|
|
|
- Upload functionality
|
|
|
|
|
|
|
|
> This application should be as simple as possible. Lots of people have implemented file
|
|
|
|
> upload systems, synchronizers, and managers way better than I have.
|
|
|
|
|
|
|
|
- Robust and flexible access control
|
|
|
|
|
|
|
|
> See above. Complex authentication can be added using a reverse proxy or any one of several
|
|
|
|
> dozen options for 3rd party middleware. The provided authentication is supposed to be
|
|
|
|
> dead simple for people who absolutely need the server to be private but absolutely cannot
|
|
|
|
> implement something more complicated.
|
|
|
|
|
|
|
|
- Pre-creation of image manipulations
|
|
|
|
|
|
|
|
> The goal of this program is just-in-time creation of the manipulated assets with
|
|
|
|
> aggressive caching; first load is slow, subsequent loads are fast. For this use case
|
|
|
|
> there's no sense creating or storing an asset until it's known to be needed.
|