add support for image resizing

This commit is contained in:
Will Norris 2013-12-04 23:42:59 -08:00
parent f6f757a75d
commit 45d07f2378
2 changed files with 51 additions and 0 deletions

View file

@ -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)