diff --git a/data.go b/data.go index 54c172b..61efaea 100644 --- a/data.go +++ b/data.go @@ -19,6 +19,7 @@ const ( optFlipHorizontal = "fh" optFormatJPEG = "jpeg" optFormatPNG = "png" + optFormatSVG = "svg" optFormatTIFF = "tiff" optPrimitivePrefix = "p" optRotatePrefix = "r" @@ -70,7 +71,7 @@ type Options struct { // will always be overwritten by the value of Proxy.ScaleUp. ScaleUp bool - // Desired image format. Valid values are "jpeg", "png", "tiff". + // Desired image format. Valid values are "jpeg", "png", "svg", "tiff". Format string // Crop rectangle params @@ -256,7 +257,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, opt == optFormatTIFF: + case opt == optFormatJPEG, opt == optFormatPNG, opt == optFormatSVG, opt == optFormatTIFF: options.Format = opt case opt == optSmartCrop: options.SmartCrop = true diff --git a/imageproxy.go b/imageproxy.go index 8a37a56..3d53639 100644 --- a/imageproxy.go +++ b/imageproxy.go @@ -263,6 +263,9 @@ func peekContentType(p *bufio.Reader) string { if err != nil && err != bufio.ErrBufferFull && err != io.EOF { return "" } + if bytes.HasPrefix(byt, []byte("