Skip to content

Repository files navigation

mod_dims

mod_dims is an Apache httpd module that resizes, crops, and reformats images on request.

/dims4/CLIENT/6d3dcb/2147483647/resize/100x100/?url=https://example.com/cat.jpg

That fetches cat.jpg, resizes it to fit 100 by 100, and returns it.

Nothing is cached. Every variant is produced when it is asked for, so a site keeps one original and serves as many renditions as it needs.

📖 Documentation

Features

  • Resize, crop, thumbnail, rotate, and flip
  • Adjust brightness, sharpness, and colour
  • Convert between JPEG, PNG, GIF, WebP, and TIFF
  • Composite a watermark
  • Strip metadata and set compression quality
  • Sign a request so it cannot be altered
  • Restrict which hosts an image may come from

Why use it

Image variants on demand. Define a rendition in a template or in frontend code. There is no build step, no batch job, and no second copy of every image.

Signed URLs. A signed URL cannot be altered by a caller. /dims5/ signs with HMAC-SHA256 and covers every parameter that shapes the result. /dims4/ signs with a shared secret and stays supported.

Getting started

docker run -p 8000:8000 -e DIMS_SECRET=a-secret \
  ghcr.io/beetlebugorg/mod_dims:latest

Built for linux/amd64 and linux/arm64.

See Installation for building from source and configuring httpd.

Building

The build is CMake. The tests are C.

cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build

The suite runs in a container, against a fixture origin:

make -C test test

License

Apache License 2.0. See LICENSE and NOTICE.

About

Apache httpd module that resizes, crops, and reformats images on request

Topics

Resources

Stars

42 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages