mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
log update
This commit is contained in:
parent
e2e39e0690
commit
880ef32606
@ -39,6 +39,7 @@ func ImageExists(filename string) bool {
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
log.Debugf("file %s exists!", filename)
|
||||
return !info.IsDir()
|
||||
}
|
||||
|
||||
|
10
router.go
10
router.go
@ -42,8 +42,12 @@ func Convert(ImgPath string, ExhaustPath string, AllowedTypes []string, QUALITY
|
||||
}
|
||||
}
|
||||
if !allowed {
|
||||
log.Warnf("File extension not allowed! %s", ImgFilename)
|
||||
c.SendFile(RawImageAbs)
|
||||
msg := "File extension not allowed! " + ImgFilename
|
||||
log.Warn(msg)
|
||||
c.Send(msg)
|
||||
if ImageExists(RawImageAbs) {
|
||||
c.SendFile(RawImageAbs)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -81,7 +85,7 @@ func Convert(ImgPath string, ExhaustPath string, AllowedTypes []string, QUALITY
|
||||
//for webp, we need to create dir first
|
||||
_ = os.MkdirAll(path.Dir(WebpAbsPath), 0755)
|
||||
q, _ := strconv.ParseFloat(QUALITY, 32)
|
||||
err = WebpEncoder(RawImageAbs, WebpAbsPath, float32(q), verboseMode, nil)
|
||||
err = WebpEncoder(RawImageAbs, WebpAbsPath, float32(q), true, nil)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user