From cb09b07170ec2d9afe53464b71f85dc824f5310b Mon Sep 17 00:00:00 2001 From: jhc Date: Mon, 24 Feb 2025 18:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/logic/upload.go | 2 +- pkg/model/common.go | 20 ++++++++++---------- pkg/service/upload/upload.go | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/logic/upload.go b/pkg/logic/upload.go index 9ae2ba3..6894a62 100644 --- a/pkg/logic/upload.go +++ b/pkg/logic/upload.go @@ -172,7 +172,7 @@ func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url return } -func MakeThumbnailDefault90(imagePath, savePath string) error { +func MakeThumbnailDefault270(imagePath, savePath string) error { prefix := strings.ToLower(path.Ext("./2.jpg")) file, _ := os.Open(imagePath) diff --git a/pkg/model/common.go b/pkg/model/common.go index effcc90..55378ce 100644 --- a/pkg/model/common.go +++ b/pkg/model/common.go @@ -1,16 +1,16 @@ package model const ( - HttpType = "http://" - HttpsType = "https://" - TmpArtworkDir = "./runtime/tmp/artworks" - TmpArtistDir = "./runtime/tmp/artists" - MediaPath = "./runtime/" - TplPath = "./data/" - ImgActionRotate = "rotate" //旋转 - ImgActionRotate90 = "rotate90" //旋转 - MediaTypeVideo = "video" - MediaTypeImage = "video" + HttpType = "http://" + HttpsType = "https://" + TmpArtworkDir = "./runtime/tmp/artworks" + TmpArtistDir = "./runtime/tmp/artists" + MediaPath = "./runtime/" + TplPath = "./data/" + ImgActionRotate = "rotate" //旋转 + ImgActionRotate270 = "rotate270" //旋转 + MediaTypeVideo = "video" + MediaTypeImage = "video" ) const ( diff --git a/pkg/service/upload/upload.go b/pkg/service/upload/upload.go index cbd2d88..8c7b82a 100644 --- a/pkg/service/upload/upload.go +++ b/pkg/service/upload/upload.go @@ -135,10 +135,10 @@ func UploadImg(c *gin.Context) { _ = os.Remove(dst) dst = newDst } - } else if action == model.ImgActionRotate90 { + } else if action == model.ImgActionRotate270 { fileFullName = fmt.Sprintf("%s%s", filename, fileExt) newDst := fmt.Sprintf("%s/%s_rotate%v", imgPath, filename, fileExt) - if err = logic.MakeThumbnailDefault90(dst, newDst); err != nil { + if err = logic.MakeThumbnailDefault270(dst, newDst); err != nil { fmt.Printf("MakeThumbnailDefault90 err %+v\n", err) } else { _ = os.Remove(dst)