package gallery import ( "os" "strings" ) const defaultHeroRel = "connectionmachine/20220723_231556.jpg" // HeroRelPath returns the configured hero image path relative to images/. func HeroRelPath() string { if p := strings.TrimSpace(os.Getenv("HERO_IMAGE")); p != "" { return filepathToSlash(p) } return defaultHeroRel } // SelectHero picks the homepage hero from the gallery list. func SelectHero(images []Image) (Image, bool) { want := HeroRelPath() for _, img := range images { if img.RelPath == want { return img, true } } if len(images) > 0 { return images[0], true } return Image{}, false } func filepathToSlash(p string) string { return strings.ReplaceAll(p, "\\", "/") }