Commit 93e2bc14 authored by santiaago's avatar santiaago
Browse files

comments

parent 12bbfea7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import (
	"image/color"
)

// MapOfColorPatterns is used to build random images with colors that combine together.
func MapOfColorPatterns() map[int][]color.RGBA {
	return map[int][]color.RGBA{
		0: []color.RGBA{
+2 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ import (
	"net/http"
)

// handler for /gird/random.
// handler for "/gird/random"
// generates a black and white grid random image.
func gridRandomHandler(w http.ResponseWriter, r *http.Request) {
	m := image.NewRGBA(image.Rect(0, 0, 240, 240))
@@ -18,7 +18,7 @@ func gridRandomHandler(w http.ResponseWriter, r *http.Request) {
	writeImage(w, &img)
}

// handler for /grid/random/[0-9]
// handler for "/grid/random/[0-9]"
// generates a grid random image with a specific color based on the colorMap
func gridRandomColorHandler(w http.ResponseWriter, r *http.Request) {
	intID, err := PermalinkID(r, 3)
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ import (
	"strings"
)

// parse permalink id from URL  and return it
// PermalinkID parses an URL and extracts the id from URL and returns it.
func PermalinkID(r *http.Request, level int64) (int64, error) {
	url := strings.Replace(r.URL.String(), "http://", "", 1)
	path := strings.Split(url, "/")