支持自动转换图像文件为WebP

This commit is contained in:
GoEdgeLab
2021-10-01 16:25:31 +08:00
parent c2ea2c96d5
commit 2ab9a1d68e
5 changed files with 640 additions and 345 deletions
+14 -7
View File
@@ -6,13 +6,12 @@ import (
)
type HTTPWebConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Locations []*HTTPLocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
LocationRefs []*HTTPLocationRef `yaml:"locationRefs" json:"locationRefs"` // 路径规则应用
//GzipRef *HTTPGzipRef `yaml:"gzipRef" json:"gzipRef"` // Gzip引用
//Gzip *HTTPCompressGzipConfig `yaml:"gzip" json:"gzip"` // Gzip配置
Compression *HTTPCompressionConfig `yaml:"compression" json:"compression"` //
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Locations []*HTTPLocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
LocationRefs []*HTTPLocationRef `yaml:"locationRefs" json:"locationRefs"` // 路径规则应用
Compression *HTTPCompressionConfig `yaml:"compression" json:"compression"` // 压缩配置
WebP *WebPImageConfig `yaml:"webp" json:"webp"` // WebP配置
Charset *HTTPCharsetConfig `yaml:"charset" json:"charset"` // 字符编码
Shutdown *HTTPShutdownConfig `yaml:"shutdown" json:"shutdown"` // 临时关闭配置
Pages []*HTTPPageConfig `yaml:"pages" json:"pages"` // 特殊页面配置
@@ -234,6 +233,14 @@ func (this *HTTPWebConfig) Init() error {
}
}
// webp
if this.WebP != nil {
err := this.WebP.Init()
if err != nil {
return err
}
}
return nil
}