mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-30 22:34:18 -05:00
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.
This commit is contained in:
parent
576b7c023a
commit
2937bf84f6
2 changed files with 18 additions and 61 deletions
65
README.md
65
README.md
|
@ -23,66 +23,13 @@ imageproxy URLs are of the form `http://localhost/{options}/{remote_url}`.
|
||||||
|
|
||||||
### Options ###
|
### Options ###
|
||||||
|
|
||||||
Options are specified as a comma delimited list of parameters, which can be
|
Options are available for resizing, rotation, flipping, and digital signatures
|
||||||
supplied in any order. Duplicate parameters overwrite previous values.
|
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).
|
See the full list of available options at
|
||||||
|
<https://godoc.org/willnorris.com/go/imageproxy#ParseOptions>.
|
||||||
#### 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.
|
|
||||||
|
|
||||||
### Remote URL ###
|
### Remote URL ###
|
||||||
|
|
||||||
|
|
14
data.go
14
data.go
|
@ -108,7 +108,8 @@ func (o Options) transform() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseOptions parses str as a list of comma separated transformation options.
|
// 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
|
// Size and Cropping
|
||||||
//
|
//
|
||||||
|
@ -150,7 +151,16 @@ func (o Options) transform() bool {
|
||||||
// Quality
|
// Quality
|
||||||
//
|
//
|
||||||
// The "q{qualityPercentage}" option can be used to specify the quality of the
|
// 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
|
// Examples
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue