PNG was replaced by JPEG because of smaller image sizes. ~11.5KB for PNG vs just <2KB for JPEG with 20% quality.
This commit is contained in:
parent
c90f5db3a8
commit
ae67f6aa4f
@ -2,7 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"image/png"
|
"image/jpeg"
|
||||||
"justcaptcha/internal/captcha"
|
"justcaptcha/internal/captcha"
|
||||||
pcaptcha "justcaptcha/pkg/captcha"
|
pcaptcha "justcaptcha/pkg/captcha"
|
||||||
"justcaptcha/pkg/server"
|
"justcaptcha/pkg/server"
|
||||||
@ -38,7 +38,7 @@ func (h *CaptchaHandlers) Image(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
w.Header().Add("Content-Disposition", "inline; filename=\""+string(captchaID)+"\"")
|
w.Header().Add("Content-Disposition", "inline; filename=\""+string(captchaID)+"\"")
|
||||||
|
|
||||||
png.Encode(w, *captchaImage)
|
jpeg.Encode(w, *captchaImage, &jpeg.Options{Quality: 20})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *CaptchaHandlers) Solve(w http.ResponseWriter, r *http.Request) {
|
func (h *CaptchaHandlers) Solve(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user