mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 12:56:23 +02:00
add support for image resizing
This commit is contained in:
parent
f6f757a75d
commit
45d07f2378
2 changed files with 51 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
"github.com/willnorris/go-imageproxy/cache"
|
||||
"github.com/willnorris/go-imageproxy/data"
|
||||
"github.com/willnorris/go-imageproxy/transform"
|
||||
)
|
||||
|
||||
// URLError reports a malformed URL error.
|
||||
|
|
@ -115,6 +116,8 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
glog.Infof("serving from cache")
|
||||
}
|
||||
|
||||
image, _ = transform.Transform(*image, req.Options)
|
||||
|
||||
w.Header().Add("Content-Length", strconv.Itoa(len(image.Bytes)))
|
||||
w.Header().Add("Expires", image.Expires.Format(time.RFC1123))
|
||||
w.Write(image.Bytes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue