mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
add newer flags to Options string
This commit is contained in:
parent
fc8552e6b4
commit
9c911bef14
2 changed files with 52 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
package proxy
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
|
@ -41,7 +42,21 @@ type Options struct {
|
|||
}
|
||||
|
||||
func (o Options) String() string {
|
||||
return fmt.Sprintf("%vx%v", o.Width, o.Height)
|
||||
buf := new(bytes.Buffer)
|
||||
fmt.Fprintf(buf, "%vx%v", o.Width, o.Height)
|
||||
if o.Fit {
|
||||
buf.WriteString(",fit")
|
||||
}
|
||||
if o.Rotate != 0 {
|
||||
fmt.Fprintf(buf, ",r%d", o.Rotate)
|
||||
}
|
||||
if o.FlipVertical {
|
||||
buf.WriteString(",fv")
|
||||
}
|
||||
if o.FlipHorizontal {
|
||||
buf.WriteString(",fh")
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func ParseOptions(str string) *Options {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue