I am trying to integrate github.com/willnorris/imageproxy/ on an existing server and have the images served on "/proxy/" path. I have:
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
"willnorris.com/go/imageproxy"
)
func main() {
p := imageproxy.NewProxy(nil, nil)
router := mux.NewRouter()
router.NewRoute().Name("proxy").Methods("GET").PathPrefix("/proxy/").Handler(http.StripPrefix("/proxy/", p))
server := &http.Server{
Addr: ":8000",
Handler: router,
}
//server.Handler = p
log.Printf("Listening at %v", server.Addr)
log.Fatal(server.ListenAndServe())
}
When I try to resize an image, the first digit seems to get cutoff:
http://127.0.0.1:8000/proxy/250x,/https:/octodex.github.com/images/codercat.jpg
returns a 50x50 image rather than a 250x250 image.
A 250x250 image is accessable by
http://127.0.0.1:8000/proxy/2250x,/https:/octodex.github.com/images/codercat.jpg
Uncommenting server.Handler = p
works and images are resized as expected.