diff --git a/html/album.templ b/html/album.templ
index 5625a72..aab445c 100644
--- a/html/album.templ
+++ b/html/album.templ
@@ -7,7 +7,7 @@ templ Album(images []string, activePage string, pages []string) {
for _, img := range images {
- @AvifImage("album/"+img, img, true)
+ @AvifAlbumImage("album/"+img, img)
}
diff --git a/html/image.templ b/html/image.templ
index 5d1a767..f21cb6b 100644
--- a/html/image.templ
+++ b/html/image.templ
@@ -4,6 +4,8 @@ import (
"crypto/sha256"
"encoding/hex"
"log"
+ "os"
+ "path/filepath"
"piekarnikgosi/utils"
)
@@ -24,6 +26,26 @@ func processImage(fileName string) string {
return "/" + dst[4:]
}
+func thumbnailPath(fullPath string) string {
+ ext := filepath.Ext(fullPath)
+ return fullPath[:len(fullPath)-len(ext)] + "_thumb.avif"
+}
+
+templ AvifAlbumImage(srcPath, alt string) {
+
+}
+
+func albumImageSrc(srcPath string) string {
+ thumb := thumbnailPath(srcPath)
+ if _, err := os.Stat("img/" + thumb); err == nil {
+ return thumb
+ }
+ return srcPath
+}
+
templ AvifImage(srcPath, alt string, lazy bool) {
