feat: images

This commit is contained in:
2026-03-02 22:38:01 +01:00
parent e689ab08c9
commit 3cc632e358
19 changed files with 517 additions and 28 deletions
+20
View File
@@ -0,0 +1,20 @@
package handleimage
import (
"io"
"log/slog"
"net/http"
)
func (h *Handler) getImage(w http.ResponseWriter, r *http.Request) {
uid := r.PathValue("uid")
img, mime, err := h.img.GetImage(r.Context(), uid)
if err != nil {
slog.Error("error wile serving image", "err", err, "uid", uid)
w.WriteHeader(http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", mime)
io.Copy(w, img)
}