webp fix v1

This commit is contained in:
tamakyi
2026-10-15 11:41:19 +08:00
parent 6ffc87e4a8
commit e4457e3da4
15 changed files with 1297 additions and 39 deletions
+12 -1
View File
@@ -14,6 +14,15 @@ import (
// MaxUploadBytes 与真实实现保持一致(8MB 单图上限,bodylimit 中间件依赖此值语义)。
const MaxUploadBytes = 8 * 1024 * 1024
// EncodeSpec 与真实实现的编码档位结构保持字段一致。
type EncodeSpec struct {
MaxSide int
Quality float32
}
// GeneralEncodeSpec 与真实实现保持一致(route/question 引用)。
var GeneralEncodeSpec = EncodeSpec{MaxSide: 1600, Quality: 80}
func UploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
return "", nil
}
@@ -26,6 +35,8 @@ func UploadBackgroundToS3(file multipart.File, fileHeader *multipart.FileHeader)
return "", nil
}
func ConvertStaticImageToWebP(r io.Reader) ([]byte, error) { return nil, nil }
func ConvertStaticImageToWebP(r io.Reader, spec EncodeSpec) ([]byte, error) { return nil, nil }
func ConvertGifToAnimatedWebP(gifData []byte) ([]byte, error) { return nil, nil }
func isSupportedImage(data []byte) bool { return true }