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.
- 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
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.
docker run -p 8000:8000 -e DIMS_SECRET=a-secret \
ghcr.io/beetlebugorg/mod_dims:latestBuilt for linux/amd64 and linux/arm64.
See Installation for building from source and configuring httpd.
The build is CMake. The tests are C.
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build buildThe suite runs in a container, against a fixture origin:
make -C test test