This commit is contained in:
蒋海成 2025-02-24 18:34:46 +08:00
parent 3e33992542
commit cb09b07170
3 changed files with 13 additions and 13 deletions

View File

@ -172,7 +172,7 @@ func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url
return return
} }
func MakeThumbnailDefault90(imagePath, savePath string) error { func MakeThumbnailDefault270(imagePath, savePath string) error {
prefix := strings.ToLower(path.Ext("./2.jpg")) prefix := strings.ToLower(path.Ext("./2.jpg"))
file, _ := os.Open(imagePath) file, _ := os.Open(imagePath)

View File

@ -8,7 +8,7 @@ const (
MediaPath = "./runtime/" MediaPath = "./runtime/"
TplPath = "./data/" TplPath = "./data/"
ImgActionRotate = "rotate" //旋转 ImgActionRotate = "rotate" //旋转
ImgActionRotate90 = "rotate90" //旋转 ImgActionRotate270 = "rotate270" //旋转
MediaTypeVideo = "video" MediaTypeVideo = "video"
MediaTypeImage = "video" MediaTypeImage = "video"
) )

View File

@ -135,10 +135,10 @@ func UploadImg(c *gin.Context) {
_ = os.Remove(dst) _ = os.Remove(dst)
dst = newDst dst = newDst
} }
} else if action == model.ImgActionRotate90 { } else if action == model.ImgActionRotate270 {
fileFullName = fmt.Sprintf("%s%s", filename, fileExt) fileFullName = fmt.Sprintf("%s%s", filename, fileExt)
newDst := fmt.Sprintf("%s/%s_rotate%v", imgPath, 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) fmt.Printf("MakeThumbnailDefault90 err %+v\n", err)
} else { } else {
_ = os.Remove(dst) _ = os.Remove(dst)