if to switch to improve readability

This commit is contained in:
Antoni Sawicki 2020-10-26 01:32:09 -07:00
parent 69efa1fb92
commit 1ddf005a23
1 changed files with 3 additions and 2 deletions

5
wrp.go
View File

@ -356,7 +356,8 @@ func (w wrpReq) capture() {
ismap[mappath] = w
var ssize string
var sw, sh int
if w.imgType == "gif" {
switch w.imgType {
case "gif":
i, err := png.Decode(bytes.NewReader(pngcap))
if err != nil {
log.Printf("%s Failed to decode screenshot: %s\n", w.req.RemoteAddr, err)
@ -379,7 +380,7 @@ func (w wrpReq) capture() {
sw = i.Bounds().Max.X
sh = i.Bounds().Max.Y
log.Printf("%s Encoded GIF image: %s, Size: %s, Colors: %d, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, w.colors, sw, sh)
} else if w.imgType == "png" {
case "png":
pngbuf := bytes.NewBuffer(pngcap)
img[imgpath] = *pngbuf
cfg, _, _ := image.DecodeConfig(pngbuf)