From 43719eba8b6bb280c11263845c7a23e295463df9 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Sun, 29 Sep 2024 01:24:56 +0200 Subject: [PATCH] Add GIF image format --- idicon.go | 4 ++++ static/index.html | 1 + 2 files changed, 5 insertions(+) diff --git a/idicon.go b/idicon.go index e42cc07..42a8157 100644 --- a/idicon.go +++ b/idicon.go @@ -7,6 +7,7 @@ import ( "github.com/BurntSushi/toml" "github.com/gorilla/mux" "idicon/icons" + "image/gif" "image/jpeg" "image/png" "log" @@ -85,6 +86,9 @@ func requestHandler(w http.ResponseWriter, r *http.Request) { } else if ct == "jpeg" || cth == "image/jpeg" { w.Header().Add("Content-Type", "image/jpeg") err = jpeg.Encode(w, iconGenerator.GenIcon(id, size), nil) + } else if ct == "gif" || cth == "image/gif" { + w.Header().Add("Content-Type", "image/gif") + err = gif.Encode(w, iconGenerator.GenIcon(id, size), nil) } else { w.Header().Add("Content-Type", "image/png") err = png.Encode(w, iconGenerator.GenIcon(id, size)) diff --git a/static/index.html b/static/index.html index 4ef8d90..30b734d 100644 --- a/static/index.html +++ b/static/index.html @@ -190,6 +190,7 @@