Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.
/ oz-images Public archive

Microservice to serve images and thumbnails

Notifications You must be signed in to change notification settings

mgax/oz-images

Repository files navigation

Image scaling service

Serve original and scaled images from a static folder.

Usage

make
docker-compose up -d

To mount a specific folder for the images, add the following lines to a docker-compose.override.yml file:

version: "2"

services:

  app:
    volumes:
      - path/to/images:/app/images

Images are served at http://localhost:8080/image/$filename. The endpoint supports a size argument which returns scaled images, e.g. /image/$filename?size=100x100.

Scaling keeps the original aspect ratio and constraining the thumbnail to fit inside the given bounding box. This is done using Imagemagick's convert -thumbnail command.

The service keeps statistics about images served. They can be retrieved at the /stats endpoint:

{
  "requests":7,
  "originals":4,
  "thumbnails":3,
  "cache_hits":2,
  "cache_misses":1
}

Development

To run the test suite, simply run make test. It will spin up a docker container and run the tests.

To open an interactive docker container that mounts the source code repository in the app directory, run make sh. This is useful when adding npm dependencies.

To compile the TypeScript source to JavaScript, e.g. in an interactive Docker container, run make ts.

About

Microservice to serve images and thumbnails

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published