diff --git a/plugins/meme/meme.go b/plugins/meme/meme.go index 3409d33..9b8eff1 100644 --- a/plugins/meme/meme.go +++ b/plugins/meme/meme.go @@ -42,6 +42,7 @@ type memeText struct { XPerc float64 `json:"x"` YPerc float64 `json:"y"` Text string `json:"t"` + Caps bool `json:"c"` } var horizon = 24 * 7 @@ -329,8 +330,8 @@ func (p *MemePlugin) findFontSize(config []memeText, w, h int, sizes []float64) func defaultFormatConfig() []memeText { return []memeText{ - {XPerc: 0.5, YPerc: 0.05}, - {XPerc: 0.5, YPerc: 0.95}, + {XPerc: 0.5, YPerc: 0.05, Caps: true}, + {XPerc: 0.5, YPerc: 0.95, Caps: true}, } } @@ -395,6 +396,12 @@ func (p *MemePlugin) genMeme(meme string, bully image.Image, config []memeText) fontLocation := p.c.Get("meme.font", "impact.ttf") m.LoadFontFace(fontLocation, p.findFontSize(config, w, h, fontSizes)) + for i, c := range config { + if c.Caps { + config[i].Text = strings.ToUpper(c.Text) + } + } + // Apply black stroke m.SetHexColor("#000") strokeSize := 6 diff --git a/plugins/meme/webHandlers.go b/plugins/meme/webHandlers.go index e7f190b..94e7df3 100644 --- a/plugins/meme/webHandlers.go +++ b/plugins/meme/webHandlers.go @@ -46,7 +46,7 @@ func (p *MemePlugin) all(w http.ResponseWriter, r *http.Request) { for n, u := range memes { config, ok := configs[n] if !ok { - b, _ := json.Marshal(defaultFormatConfig) + b, _ := json.Marshal(defaultFormatConfig()) config = string(b) } realURL, err := url.Parse(u)