From b282eecc58f3a9e3e00f654f07dcdba3596803e1 Mon Sep 17 00:00:00 2001 From: bronkuu Date: Tue, 9 Jun 2026 16:04:04 +0200 Subject: [PATCH] automatic image class --- html/doc.go | 3 --- html/image.templ | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) delete mode 100644 html/doc.go diff --git a/html/doc.go b/html/doc.go deleted file mode 100644 index 53629a7..0000000 --- a/html/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -//go:generate templ generate - -package html diff --git a/html/image.templ b/html/image.templ index 5605be3..9bc0c36 100644 --- a/html/image.templ +++ b/html/image.templ @@ -4,6 +4,7 @@ import ( "crypto/sha256" "encoding/hex" "log" + "strings" "piekarnikgosi/utils" ) @@ -14,7 +15,7 @@ func imageSrcDst(input string) (src, dst string) { return src, dst } -func ProcessImage(fileName string) string { +func processImage(fileName string) string { dst, err := utils.CopyIfNotExists(imageSrcDst(fileName)) if err != nil { @@ -24,6 +25,20 @@ func ProcessImage(fileName string) string { return dst[4:] } +func stripSize(path string) string { + if strings.Contains(path, "wide") { + return "wide" + } + if strings.Contains(path, "tall") { + return "tall" + } + if strings.Contains(path, "large") { + return "large" + } + return "" + } + templ AvifImage(srcPath, alt string) { - { + + { }