refactor: GIF 单独归类、跨文件系统复制回退与异常处理优化

This commit is contained in:
2025-03-12 21:01:04 +08:00
parent 9ed579d04e
commit 0ebd84d3fe
6 changed files with 83 additions and 14 deletions
+12 -1
View File
@@ -114,6 +114,7 @@ func doPickImageFile(uid string, rootDir string, imagePath2WidthHeightMap map[st
moveHorizontalImage(rootDir, uid)
moveVerticalImage(rootDir, uid)
moveSquareImage(rootDir, uid)
moveGifImage(rootDir, uid)
}
// 统一处理gif
@@ -255,7 +256,7 @@ func handleSquareImage(currentImagePath string, width int) {
vars.ImageSquare8KList = append(vars.ImageSquare8KList, currentImagePath)
} else if width < 10000 {
vars.ImageSquare9KList = append(vars.ImageSquare9KList, currentImagePath)
} else if width > 10000 {
} else if width >= 10000 {
vars.ImageSquareHKList = append(vars.ImageSquareHKList, currentImagePath)
}
}
@@ -498,3 +499,13 @@ func moveSquareImage(rootDir string, uid string) {
util.DoMoveFileToDir(vars.ImageSquareHKList, imageDirPath)
}
}
// 移动gif图片
func moveGifImage(rootDir string, uid string) {
if len(vars.ImageGifList) > 0 {
pathSeparator := string(os.PathSeparator)
imageDirPath := rootDir + pathSeparator + uid + "-图片_GIF"
util.CreateDir(imageDirPath)
util.DoMoveFileToDir(vars.ImageGifList, imageDirPath)
}
}