42floors / waitress

Image Server
Apache License 2.0
0 stars 0 forks source link

Waitress

Dependencies

Installation

Running go build will result in a binary named waitress being created. This can then be moved to the /usr/local or the preferred install path.

Running

Usage of waitress: -binding="0.0.0.0": bind the server to the specified ip -config="": conf file (see config.yml.sample) -port="3000": run the server on the specified port

Image processing

The format is specified as the first part of the URL path. The syntax is similar to the geometry syntax of ImageMagick.

Syntax

s ::= ( width | 'x' height | width 'x' height ) ( '#' | '^' | '!' )?
bg ::= (
    '#' [0-9A-Fa-f]{6} |
    'rgb(' \d{1,3} ',' \d{1,3} ',' \d{1,3} ')' |
    'rgba(' \d{1,3} ',' \d{1,3} ',' \d{1,3} ',' \d+ (\.\d+)? ')' |
    'hsl(' \d{1,3} ',' \d{1,3} '%,' \d{1,3} '%)' |
    'hsla(' \d{1,3} ',' \d{1,3} '%,' \d{1,3} '%,' \d+ (\.\d+)? ')'        
)

Size

s=700: Resize the image to have a width of 700 (maintains aspect ratio) s=x700: Resize the image to have a height of 700 (maintains aspect ratio) s=700x700: Resize the image to have a width and height of 700. This maintains the aspect ratio and pads image with a background color.

Options

#: Crop the image to fill the specified size (This need to be URL escaped) ^: The size specified is a minimum. The resulting image may be bigger *: The size specified is a maximum. The resulting image may be smaller !: Do not preserve the aspect ratio.

Examples

Support both syntaxes?

TODO: Makefile