aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/grils/gril.go23
1 files changed, 13 insertions, 10 deletions
diff --git a/modules/grils/gril.go b/modules/grils/gril.go
index a450647..fe316cd 100644
--- a/modules/grils/gril.go
+++ b/modules/grils/gril.go
@@ -28,23 +28,26 @@ type Gril struct {
28 Lists []int 28 Lists []int
29} 29}
30 30
31func (g *Gril) ImagePath() string { 31func (g *Gril) ImagePath(prioritizeThumbnail bool) string {
32 var big string
32 exts := []string{"png", "jpg", "gif", "jpeg"} 33 exts := []string{"png", "jpg", "gif", "jpeg"}
33 var imagePath string
34 for _, ext := range exts { 34 for _, ext := range exts {
35 path := fmt.Sprintf("assets/img/gril/%d/0.%s", g.ID, ext) 35 path := fmt.Sprintf("assets/img/gril/%d/0.%s", g.ID, ext)
36 if _, err := os.Stat(path); err == nil { 36 if _, err := os.Stat(path); err == nil {
37 return path 37 if prioritizeThumbnail {
38 big = path
39 } else {
40 return path
41 }
38 } 42 }
39 } 43 }
40 44
41 if len(imagePath) == 0 { 45 for _, ext := range exts {
42 for _, ext := range exts { 46 path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext)
43 path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext) 47 if _, err := os.Stat(path); err == nil {
44 if _, err := os.Stat(path); err == nil { 48 return path
45 return path
46 }
47 } 49 }
48 } 50 }
49 return "" 51
52 return big
50} 53}