feat(templates): Get static mounted images

This commit is contained in:
2024-12-03 19:56:57 +01:00
parent d910a722df
commit 4deda8adf1
4 changed files with 13 additions and 5 deletions

View File

@@ -3,6 +3,8 @@ package templates
import (
_ "embed"
"fmt"
"log"
"os"
)
//go:embed card/en.html
@@ -44,10 +46,10 @@ func GetTemplate(locale, templateName string) (string, error) {
}
func GetImage(imageName string) string {
switch imageName {
case "sponsoringheader":
return ImageSponsoringHeaderBase64
default:
content, err := os.ReadFile("static/images/" + imageName + ".base64")
if content == nil || err != nil {
log.Printf("error reading image %s: %v", imageName, err)
return ImageErrorBase64
}
return string(content)
}