renamed files besd on their orientation

This commit is contained in:
bronku 2026-06-09 16:31:33 +02:00
parent b282eecc58
commit dd4a4268e0
216 changed files with 18 additions and 20 deletions

View file

@ -4,7 +4,6 @@ import (
"crypto/sha256"
"encoding/hex"
"log"
"strings"
"piekarnikgosi/utils"
)
@ -25,20 +24,6 @@ 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) {
<img class={stripSize(srcPath)} src={ processImage(srcPath) } alt={ alt }/>
<img src={ processImage(srcPath) } alt={ alt }/>
}

View file

@ -1,4 +1,17 @@
package html
import "strings"
func stripSize(path string) string {
if strings.Contains(path, "landscape") {
return "landscape"
}
if strings.Contains(path, "portrait") {
return "portrait"
}
if strings.Contains(path, "large") {
return "large"
}
return ""
}
templ Portfolio(images []string, activePage string, pages []string) {
@layout("portfolio") {
@ -7,7 +20,7 @@ templ Portfolio(images []string, activePage string, pages []string) {
<section>
<div id="portfolio-grid">
for _, img := range images {
<div>
<div class={stripSize(img)}>
@AvifImage("portfolio/"+img, "portfolio")
</div>
}