aboutsummaryrefslogtreecommitdiff
path: root/modules/grils
diff options
context:
space:
mode:
Diffstat (limited to 'modules/grils')
-rw-r--r--modules/grils/grils.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/grils/grils.go b/modules/grils/grils.go
index a1c84c7..7cbec77 100644
--- a/modules/grils/grils.go
+++ b/modules/grils/grils.go
@@ -8,6 +8,7 @@ import (
8 "github.com/julienschmidt/httprouter" 8 "github.com/julienschmidt/httprouter"
9 "log" 9 "log"
10 "net/http" 10 "net/http"
11 "os"
11 "regexp" 12 "regexp"
12 "strconv" 13 "strconv"
13 "strings" 14 "strings"
@@ -173,6 +174,18 @@ func (m *GrilsModule) viewGril(w http.ResponseWriter, r *http.Request, p httprou
173 data["user"] = user 174 data["user"] = user
174 data["gril"] = gril 175 data["gril"] = gril
175 176
177 // get the file ending
178 exts := []string{"png", "jpg", "gif", "jpeg"}
179 var imagePath string
180 for _, ext := range exts {
181 path := fmt.Sprintf("assets/img/gril/%d/0.%s", gril.ID, ext)
182 if _, err := os.Stat(path); err == nil {
183 imagePath = path
184 break
185 }
186 }
187 data["imagePath"] = "/" + imagePath
188
176 m.g.Renderer.RenderPage("gril", w, data) 189 m.g.Renderer.RenderPage("gril", w, data)
177} 190}
178 191