mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-23 02:45:13 +02:00
use any and min builtins
This commit is contained in:
parent
07c1c27092
commit
f2bc67185d
2 changed files with 6 additions and 12 deletions
|
|
@ -113,7 +113,7 @@ func NewProxy(transport http.RoundTripper, cache Cache) *Proxy {
|
||||||
Transport: &TransformingTransport{
|
Transport: &TransformingTransport{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
CachingClient: client,
|
CachingClient: client,
|
||||||
log: func(format string, v ...interface{}) {
|
log: func(format string, v ...any) {
|
||||||
if proxy.Verbose {
|
if proxy.Verbose {
|
||||||
proxy.logf(format, v...)
|
proxy.logf(format, v...)
|
||||||
}
|
}
|
||||||
|
|
@ -445,7 +445,7 @@ func should304(req *http.Request, resp *http.Response) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Proxy) log(v ...interface{}) {
|
func (p *Proxy) log(v ...any) {
|
||||||
if p.Logger != nil {
|
if p.Logger != nil {
|
||||||
p.Logger.Print(v...)
|
p.Logger.Print(v...)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -453,7 +453,7 @@ func (p *Proxy) log(v ...interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Proxy) logf(format string, v ...interface{}) {
|
func (p *Proxy) logf(format string, v ...any) {
|
||||||
if p.Logger != nil {
|
if p.Logger != nil {
|
||||||
p.Logger.Printf(format, v...)
|
p.Logger.Printf(format, v...)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -474,7 +474,7 @@ type TransformingTransport struct {
|
||||||
// responses are properly cached.
|
// responses are properly cached.
|
||||||
CachingClient *http.Client
|
CachingClient *http.Client
|
||||||
|
|
||||||
log func(format string, v ...interface{})
|
log func(format string, v ...any)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoundTrip implements the http.RoundTripper interface.
|
// RoundTrip implements the http.RoundTripper interface.
|
||||||
|
|
|
||||||
10
transform.go
10
transform.go
|
|
@ -212,14 +212,8 @@ func cropParams(m image.Image, opt Options) image.Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bottom right coordinate of crop
|
// bottom right coordinate of crop
|
||||||
x1 := x0 + w
|
x1 := min(x0+w, imgW)
|
||||||
if x1 > imgW {
|
y1 := min(y0+h, imgH)
|
||||||
x1 = imgW
|
|
||||||
}
|
|
||||||
y1 := y0 + h
|
|
||||||
if y1 > imgH {
|
|
||||||
y1 = imgH
|
|
||||||
}
|
|
||||||
|
|
||||||
return image.Rect(x0, y0, x1, y1)
|
return image.Rect(x0, y0, x1, y1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue