Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
package common
import (
"bytes"
"image"
"io"
"net/http"
)
type PictureProp struct {
Size int `json:"size" bson:"size,omitempty"` // 单位:b
Width int `json:"height" bson:"height,omitempty"`
Height int `json:"width" bson:"width,omitempty"`
}
const ImgUrlHost = "http://image.lhexm.com/"
func GetPictureProp(imgURL string) PictureProp {
res, err := http.Get(imgURL)
if err != nil {
return PictureProp{}
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
return PictureProp{}
}
buf := bytes.NewBuffer(body)
cfg, _, err := image.DecodeConfig(buf)
if err != nil {
return PictureProp{}
}
return PictureProp{
Size: len(body),
Width: cfg.Width,
Height: cfg.Height,
}
}