From 2937bf84f601cf7d902dc135061c63c51291e7b8 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Thu, 1 Jun 2017 07:29:09 -0700 Subject: [PATCH] readme: point to godoc for detail option docs trying to keep this in sync between the two locations wasn't really working and isn't necessary. --- README.md | 65 +++++-------------------------------------------------- data.go | 14 ++++++++++-- 2 files changed, 18 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 6cd8ec3..3767412 100644 --- a/README.md +++ b/README.md @@ -23,66 +23,13 @@ imageproxy URLs are of the form `http://localhost/{options}/{remote_url}`. ### Options ### -Options are specified as a comma delimited list of parameters, which can be -supplied in any order. Duplicate parameters overwrite previous values. +Options are available for resizing, rotation, flipping, and digital signatures +among a few others. Options for are specified as a comma delimited list of +parameters, which can be supplied in any order. Duplicate parameters overwrite +previous values. -The format is a superset of [resize.ly's options](https://resize.ly/#demo). - -#### Size #### - -The size option takes the general form `{width}x{height}`, where width and -height are numbers. Integer values greater than 1 are interpreted as exact -pixel values. Floats between 0 and 1 are interpreted as percentages of the -original image size. If either value is omitted or set to 0, it will be -automatically set to preserve the aspect ratio based on the other dimension. -If a single number is provided (with no "x" separator), it will be used for -both height and width. - -#### Crop Mode #### - -Depending on the options specified, an image may be cropped to fit the -requested size. In all cases, the original aspect ratio of the image will be -preserved; imageproxy will never stretch the original image. - -When no explicit crop mode is specified, the following rules are followed: - - - If both width and height values are specified, the image will be scaled to - fill the space, cropping if necessary to fit the exact dimension. - - - If only one of the width or height values is specified, the image will be - resized to fit the specified dimension, scaling the other dimension as - needed to maintain the aspect ratio. - -If the `fit` option is specified together with a width and height value, the -image will be resized to fit within a containing box of the specified size. As -always, the original aspect ratio will be preserved. Specifying the `fit` -option with only one of either width or height does the same thing as if `fit` -had not been specified. - -#### Rotate #### - -The `r{degrees}` option will rotate the image the specified number of degrees, -counter-clockwise. Valid degrees values are `90`, `180`, and `270`. Images -are rotated **after** being resized. - -#### Flip #### - -The `fv` option will flip the image vertically. The `fh` option will flip the -image horizontally. Images are flipped **after** being resized and rotated. - -#### Quality #### - -The `q{percentage}` option can be used to specify the output quality (JPEG -only). If not specified, the default value of `95` is used. - -#### Signature #### - -The `s{signature}` option specifies an optional base64 encoded HMAC used to -sign the remote URL in the request. The HMAC key used to verify signatures is -provided to the imageproxy server on startup. - -See [URL Signing](https://github.com/willnorris/imageproxy/wiki/URL-signing) -for examples of generating signatures. +See the full list of available options at +. ### Remote URL ### diff --git a/data.go b/data.go index 13bc37d..6eae282 100644 --- a/data.go +++ b/data.go @@ -108,7 +108,8 @@ func (o Options) transform() bool { } // ParseOptions parses str as a list of comma separated transformation options. -// The following options can be specified in any order: +// The options can be specified in in order, with duplicate options overwriting +// previous values. // // Size and Cropping // @@ -150,7 +151,16 @@ func (o Options) transform() bool { // Quality // // The "q{qualityPercentage}" option can be used to specify the quality of the -// output file (JPEG only) +// output file (JPEG only). If not specified, the default value of "95" is used. +// +// Signature +// +// The "s{signature}" option specifies an optional base64 encoded HMAC used to +// sign the remote URL in the request. The HMAC key used to verify signatures is +// provided to the imageproxy server on startup. +// +// See https://github.com/willnorris/imageproxy/wiki/URL-signing +// for examples of generating signatures. // // Examples //