Only label if form value says so
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steven Polley 2019-03-03 14:35:35 -07:00
parent d475ea5083
commit 8c1e447286

View File

@ -136,6 +136,7 @@ func linearInterpolation(c1, c2, mu uint32) uint32 {
} }
func renderTile(w http.ResponseWriter, r *http.Request) { func renderTile(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
components := strings.Split(r.URL.Path, "/")[1:] components := strings.Split(r.URL.Path, "/")[1:]
if len(components) != 4 || components[0] != "mandelbrot" || components[3][len(components[3])-4:] != ".png" { if len(components) != 4 || components[0] != "mandelbrot" || components[3][len(components[3])-4:] != ".png" {
@ -172,7 +173,9 @@ func renderTile(w http.ResponseWriter, r *http.Request) {
} }
wg.Wait() wg.Wait()
addLabel(img, 10, 10, fmt.Sprintf("%d/%d/%d", tileZoom, tileX, tileY)) if r.FormValue("label") == "1" {
addLabel(img, 10, 10, fmt.Sprintf("%d/%d/%d", tileZoom, tileX, tileY))
}
w.Header().Set("Content-Type", "image/png") w.Header().Set("Content-Type", "image/png")
png.Encode(w, img) png.Encode(w, img)
} }