allow forcing encoding as tiff

This commit is contained in:
Will Norris 2017-08-31 17:03:17 -07:00
parent c1a9dab401
commit 817908938e
3 changed files with 25 additions and 8 deletions

View file

@ -29,6 +29,7 @@ const (
optFlipHorizontal = "fh"
optFormatJPEG = "jpeg"
optFormatPNG = "png"
optFormatTIFF = "tiff"
optRotatePrefix = "r"
optQualityPrefix = "q"
optSignaturePrefix = "s"
@ -77,7 +78,7 @@ type Options struct {
// will always be overwritten by the value of Proxy.ScaleUp.
ScaleUp bool
// Desired image format. Valid values are "jpeg", "png".
// Desired image format. Valid values are "jpeg", "png", "tiff".
Format string
// Crop rectangle params
@ -202,8 +203,8 @@ func (o Options) transform() bool {
//
// Format
//
// The "jpeg" and "png" options can be used to specify the desired image format
// of the proxied image.
// The "jpeg", "png", and "tiff" options can be used to specify the desired
// image format of the proxied image.
//
// Signature
//
@ -243,7 +244,7 @@ func ParseOptions(str string) Options {
options.FlipHorizontal = true
case opt == optScaleUp: // this option is intentionally not documented above
options.ScaleUp = true
case opt == optFormatJPEG, opt == optFormatPNG:
case opt == optFormatJPEG, opt == optFormatPNG, opt == optFormatTIFF:
options.Format = opt
case strings.HasPrefix(opt, optRotatePrefix):
value := strings.TrimPrefix(opt, optRotatePrefix)