feat(gallery): packing

This commit is contained in:
2026-05-31 15:48:18 +02:00
parent 9282f1f634
commit 8a72b96e66
12 changed files with 126 additions and 19 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ import (
)
func (h *Handler) gallery(w http.ResponseWriter, r *http.Request) {
imgs, err := h.srv.GetImages(r.Context())
imgs, err := h.srv.GetGallery(r.Context(), 5)
if err != nil {
slog.Error("could not get images", "err", err)
w.WriteHeader(http.StatusInternalServerError)
@@ -7,6 +7,7 @@ import (
"net/http"
"net/url"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/gallery"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/images"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"github.com/a-h/templ"
@@ -34,6 +35,7 @@ func New(renderer renderer, srv galleryService, cfg *config.Gallery) *Handler {
type galleryService interface {
GetImages(ctx context.Context) (imgs []images.Image, err error)
GetGallery(ctx context.Context, width int) (gallery gallery.Gallery, err error)
}
type renderer interface {
Render(ctx context.Context, w io.Writer, r *http.Request, component templ.Component)