mirror of
https://github.com/pcvolkmer/idicon.git
synced 2025-04-19 08:36:50 +00:00
Add GIF image format
This commit is contained in:
parent
59e4dce4e3
commit
43719eba8b
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"idicon/icons"
|
"idicon/icons"
|
||||||
|
"image/gif"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
"image/png"
|
"image/png"
|
||||||
"log"
|
"log"
|
||||||
@ -85,6 +86,9 @@ func requestHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else if ct == "jpeg" || cth == "image/jpeg" {
|
} else if ct == "jpeg" || cth == "image/jpeg" {
|
||||||
w.Header().Add("Content-Type", "image/jpeg")
|
w.Header().Add("Content-Type", "image/jpeg")
|
||||||
err = jpeg.Encode(w, iconGenerator.GenIcon(id, size), nil)
|
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 {
|
} else {
|
||||||
w.Header().Add("Content-Type", "image/png")
|
w.Header().Add("Content-Type", "image/png")
|
||||||
err = png.Encode(w, iconGenerator.GenIcon(id, size))
|
err = png.Encode(w, iconGenerator.GenIcon(id, size))
|
||||||
|
@ -190,6 +190,7 @@
|
|||||||
<select id="contenttype" onchange="newcontenttype(this.value)">
|
<select id="contenttype" onchange="newcontenttype(this.value)">
|
||||||
<option value="png" selected>PNG</option>
|
<option value="png" selected>PNG</option>
|
||||||
<option value="jpeg">JPEG</option>
|
<option value="jpeg">JPEG</option>
|
||||||
|
<option value="gif">GIF</option>
|
||||||
<option value="svg">SVG</option>
|
<option value="svg">SVG</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user