'commit'
continuous-integration/drone/push Build is passing Details

master
黄海 4 years ago
parent b0779754b7
commit 245bb24207

Binary file not shown.

@ -68,6 +68,14 @@ func main() {
}
//拼接的下载路径
downUrl := "/dsSzxy/down/" + trueName[0:2] + "/" + trueName
//文件大小
content, err := ioutil.ReadFile(filename)
if err == nil {
fmt.Println("file size is ", len(content))
}
size := len(content)
//判断扩展名是不是图片
if ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" {
//读取本地文件
@ -86,6 +94,7 @@ func main() {
if err != nil {
fmt.Println(err)
}
//读入生成图片的base64编码
ff, _ := os.Open(thumbTrueName)
defer ff.Close()
@ -97,11 +106,13 @@ func main() {
"success": true,
"url": downUrl,
"thumbContent": sourceString,
"size": size,
})
} else {
c.JSON(200, gin.H{
"success": true,
"url": downUrl,
"size": size,
})
}
})

Loading…
Cancel
Save