forgejo/services/webhook/shared/img.go
oliverpool 4ad42a4e3f [REFACTOR] webhook shared code to prevent import cycles
(cherry picked from commit 04a398a1af8ab7552f89da4cfb9d34b9698e341c)
2024-04-05 19:36:03 +00:00

16 lines
344 B
Go

package shared
import (
"html"
"html/template"
"strconv"
"code.gitea.io/gitea/modules/setting"
)
func ImgIcon(name string, size int) template.HTML {
s := strconv.Itoa(size)
src := html.EscapeString(setting.StaticURLPrefix + "/assets/img/" + name)
return template.HTML(`<img width="` + s + `" height="` + s + `" src="` + src + `">`)
}