mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
add support for image rotation
This commit is contained in:
parent
ea76f2d0d8
commit
d506fc6881
3 changed files with 29 additions and 0 deletions
|
|
@ -32,6 +32,9 @@ type Options struct {
|
|||
// If true, resize the image to fit in the specified dimensions. Image
|
||||
// will not be cropped, and aspect ratio will be maintained.
|
||||
Fit bool
|
||||
|
||||
// Rotate image the specified degrees counter-clockwise. Valid values are 90, 180, 270.
|
||||
Rotate int
|
||||
}
|
||||
|
||||
func (o Options) String() string {
|
||||
|
|
@ -63,6 +66,11 @@ func ParseOptions(str string) *Options {
|
|||
for _, part := range parts[1:] {
|
||||
if part == "fit" {
|
||||
o.Fit = true
|
||||
continue
|
||||
}
|
||||
if len(part) > 2 && strings.HasPrefix(part, "r=") {
|
||||
o.Rotate, _ = strconv.Atoi(part[2:])
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue