Refactor: move thumbnail config from ini file to database

This commit is contained in:
HFO4
2022-03-23 19:02:39 +08:00
parent d54ca151b2
commit eaa8c9e12d
11 changed files with 139 additions and 169 deletions

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"net/http"
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
model "github.com/cloudreve/Cloudreve/v3/models"
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem"
"github.com/cloudreve/Cloudreve/v3/pkg/request"
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
@@ -174,7 +174,7 @@ func Thumb(c *gin.Context) {
}
defer resp.Content.Close()
http.ServeContent(c.Writer, c.Request, "thumb."+conf.ThumbConfig.EncodeMethod, fs.FileTarget[0].UpdatedAt, resp.Content)
http.ServeContent(c.Writer, c.Request, "thumb."+model.GetSettingByNameWithDefault("thumb_encode_method", "jpg"), fs.FileTarget[0].UpdatedAt, resp.Content)
}