Skip to content

Commit 61b337d

Browse files
committed
图片链接处理
1 parent 65545fa commit 61b337d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

controllers/BookController.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ func (this *BookController) UploadCover() {
413413
this.JsonResult(500, "图片剪切")
414414
}
415415

416-
filePath = filepath.Join("uploads", time.Now().Format("200601"), fileName+ext)
416+
filePath = strings.ReplaceAll(filepath.Join("uploads", time.Now().Format("200601"), fileName+ext), "\\", "/")
417417

418418
//生成缩略图并保存到磁盘
419419
err = graphics.ImageResizeSaveFile(subImg, 175, 230, filePath)

controllers/StaticController.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (this *StaticController) StaticFile() {
6464
http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, file)
6565
return
6666
}
67-
fmt.Println(file, "===============")
67+
6868
file = strings.ReplaceAll(strings.TrimLeft(file, "./"), "\\", "/")
6969
path := filepath.Join(utils.VirtualRoot, file)
7070
http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, path)

0 commit comments

Comments
 (0)