mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-16 21:56:43 -05:00
rename Transform back to Options
This commit is contained in:
parent
402e2c7d83
commit
f6f757a75d
2 changed files with 8 additions and 8 deletions
14
data/data.go
14
data/data.go
|
@ -10,19 +10,19 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
// Transform specifies transformations that can be performed on a
|
||||
// Options specifies transformations that can be performed on a
|
||||
// requested image.
|
||||
type Transform struct {
|
||||
type Options struct {
|
||||
Width int // requested width, in pixels
|
||||
Height int // requested height, in pixels
|
||||
}
|
||||
|
||||
func (o Transform) String() string {
|
||||
func (o Options) String() string {
|
||||
return fmt.Sprintf("%dx%d", o.Width, o.Height)
|
||||
}
|
||||
|
||||
func ParseTransform(str string) (*Transform, error) {
|
||||
t := new(Transform)
|
||||
func ParseOptions(str string) (*Options, error) {
|
||||
t := new(Options)
|
||||
var err error
|
||||
var h, w string
|
||||
|
||||
|
@ -51,8 +51,8 @@ func ParseTransform(str string) (*Transform, error) {
|
|||
}
|
||||
|
||||
type Request struct {
|
||||
URL *url.URL // URL of the image to proxy
|
||||
Transform *Transform // Image transformation to perform
|
||||
URL *url.URL // URL of the image to proxy
|
||||
Options *Options // Image transformation to perform
|
||||
}
|
||||
|
||||
// Image represents a remote image that is being proxied. It tracks where
|
||||
|
|
|
@ -54,7 +54,7 @@ func NewRequest(r *http.Request) (*data.Request, error) {
|
|||
|
||||
// query string is always part of the remote URL
|
||||
req.URL.RawQuery = r.URL.RawQuery
|
||||
req.Transform, err = data.ParseTransform(path[1])
|
||||
req.Options, err = data.ParseOptions(path[1])
|
||||
if err != nil {
|
||||
return nil, URLError{err.Error(), r.URL}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue