Documentation ¶
Index ¶
- Variables
- func ApplyPathRule(path string) string
- func CompressImageByFFmpeg(inputPath, outputPath string, maxEdgeLength int) error
- func CompressImageForTelegramByFFmpegFromBytes(input []byte) ([]byte, error)
- func CompressImageToJPEG(input []byte, maxEdgeLength, maxFileSize uint) ([]byte, error)
- func DownloadWithCache(ctx context.Context, url string, client *req.Client) ([]byte, error)
- func EscapeFileName(str string) string
- func EscapeHTML(text string) string
- func EscapeMarkdown(text string) string
- func ExtractTagsFromText(text string) []string
- func FileExists(path string) bool
- func GenerateRandomString(length int, charset ...string) string
- func GetBodyReader(ctx context.Context, url string, client *req.Client) (io.ReadCloser, error)
- func GetImageBlurScore(img image.Image) (float64, error)deprecated
- func GetImageBlurScoreFromReader(r io.Reader) (float64, error)deprecated
- func GetImagePhash(img image.Image) (string, error)
- func GetImagePhashFromReader(r io.Reader) (string, error)
- func GetImageSize(img image.Image) (int, int, error)
- func GetImageSizeFromReader(r io.Reader) (int, int, error)
- func GetReqCachedFile(url string) ([]byte, error)
- func GinBindError(ctx *gin.Context, err error)
- func GinErrorResponse(ctx *gin.Context, err error, status int, message string)
- func Init()
- func MD5Hash(data string) string
- func MkCache(path string, data []byte, td time.Duration)
- func MkFile(path string, data []byte) error
- func ParseStringTo2DArray(str, sep, sep2 string) [][]string
- func PurgeFile(path string) error
- func PurgeFileAfter(path string, td time.Duration)
- func RemoveEmptyDirectories(dirPath string) error
- func ResizeImage(img image.Image, width, height uint) image.Image
- func RmFileAfter(path string, td time.Duration)
- type RestfulCommonResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version string = "dev" BuildTime string = "Unknown" Commit string = "Unknown" )
View Source
var Client *req.Client
View Source
var Logger *slog.Logger
View Source
var ResendClient *resend.Client
View Source
var TagRe = regexp.MustCompile(`(?:^|[\p{Zs}\s.,!?(){}[\]<>\"\',。!?():;、])#([\p{L}\d_]+)`)
Functions ¶
func ApplyPathRule ¶
func CompressImageByFFmpeg ¶
使用 ffmpeg 压缩图片
func CompressImageForTelegramByFFmpegFromBytes ¶ added in v0.60.0
func CompressImageToJPEG ¶
func DownloadWithCache ¶
func EscapeFileName ¶
func EscapeHTML ¶
func EscapeMarkdown ¶
func ExtractTagsFromText ¶
func FileExists ¶
func GenerateRandomString ¶
func GetBodyReader ¶ added in v0.60.0
func GetImageBlurScore
deprecated
func GetImageBlurScoreFromReader
deprecated
added in
v0.60.0
func GetImagePhashFromReader ¶ added in v0.60.0
func GetImageSizeFromReader ¶ added in v0.60.0
func GetReqCachedFile ¶
func GinBindError ¶
func GinErrorResponse ¶
func ParseStringTo2DArray ¶
解析字符串为二维数组, 如果以字符串以引号包裹, 则无视分隔符
ParseStringTo2DArray("1,2,3;4,5,6", ",", ";") => [][]string{{"1", "2", "3"}, {"4", "5", "6"}}
ParseStringTo2DArray("1,2,3;\"4,5,6\"", ",", ";") => [][]string{{"1", "2", "3"}, {"4,5,6"}}
func ResizeImage ¶
ResizeImage resizes an image to the specified width and height.
It use golang.org/x/image/draw and CatmullRom interpolation. (Slow but high quality, and cost many memory)
func RmFileAfter ¶ added in v0.60.0
Types ¶
type RestfulCommonResponse ¶
Click to show internal directories.
Click to hide internal directories.