package view import ( "log" "net/http" "path/filepath" "streifling.com/jason/cpolis/cmd/control" ) func ServeImage(c *control.CliArgs, s *control.CookieStore) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { absFilepath, err := filepath.Abs(c.PicsDir) if err != nil { log.Println(err) http.Error(w, err.Error(), http.StatusInternalServerError) return } http.ServeFile(w, r, absFilepath+"/"+r.PathValue("pic")) } }