mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-25 13:30:51 +00:00
change image size from MB to KB
This commit is contained in:
parent
60ca1a0d50
commit
0957fedaee
4
wrp.go
4
wrp.go
@ -352,7 +352,7 @@ func (w wrpReq) capture() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
img[imgpath] = gifbuf
|
img[imgpath] = gifbuf
|
||||||
ssize = fmt.Sprintf("%.1f MB", float32(len(gifbuf.Bytes()))/1024.0/1024.0)
|
ssize = fmt.Sprintf("%.0f KB", float32(len(gifbuf.Bytes()))/1024.0)
|
||||||
sw = i.Bounds().Max.X
|
sw = i.Bounds().Max.X
|
||||||
sh = i.Bounds().Max.Y
|
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)
|
log.Printf("%s Encoded GIF image: %s, Size: %s, Colors: %d, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, w.colors, sw, sh)
|
||||||
@ -360,7 +360,7 @@ func (w wrpReq) capture() {
|
|||||||
pngbuf := bytes.NewBuffer(pngcap)
|
pngbuf := bytes.NewBuffer(pngcap)
|
||||||
img[imgpath] = *pngbuf
|
img[imgpath] = *pngbuf
|
||||||
cfg, _, _ := image.DecodeConfig(pngbuf)
|
cfg, _, _ := image.DecodeConfig(pngbuf)
|
||||||
ssize = fmt.Sprintf("%.1f MB", float32(len(pngbuf.Bytes()))/1024.0/1024.0)
|
ssize = fmt.Sprintf("%.0f KB", float32(len(pngbuf.Bytes()))/1024.0)
|
||||||
sw = cfg.Width
|
sw = cfg.Width
|
||||||
sh = cfg.Height
|
sh = cfg.Height
|
||||||
log.Printf("%s Got PNG image: %s, Size: %s, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, sw, sh)
|
log.Printf("%s Got PNG image: %s, Size: %s, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, sw, sh)
|
||||||
|
Loading…
Reference in New Issue
Block a user