|
@@ -1,5 +1,7 @@
|
|
package com.qmth.boot.core.ai.model.ocr;
|
|
package com.qmth.boot.core.ai.model.ocr;
|
|
|
|
|
|
|
|
+import com.qmth.boot.tools.io.FileUtils;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 图片类型
|
|
* 图片类型
|
|
*/
|
|
*/
|
|
@@ -22,11 +24,7 @@ public enum ImageType {
|
|
}
|
|
}
|
|
|
|
|
|
public static ImageType find(String fileName) {
|
|
public static ImageType find(String fileName) {
|
|
- String imgSuffix = getFileSuffix(fileName);
|
|
|
|
- if (imgSuffix == null) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ String imgSuffix = FileUtils.getFileSuffix(fileName);
|
|
switch (imgSuffix) {
|
|
switch (imgSuffix) {
|
|
case ".jpg":
|
|
case ".jpg":
|
|
case ".jpeg":
|
|
case ".jpeg":
|
|
@@ -39,17 +37,4 @@ public enum ImageType {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取文件后缀名(包含".")
|
|
|
|
- */
|
|
|
|
- public static String getFileSuffix(String fileName) {
|
|
|
|
- if (fileName != null) {
|
|
|
|
- int index = fileName.lastIndexOf(".");
|
|
|
|
- if (index > -1) {
|
|
|
|
- return fileName.substring(index).toLowerCase();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|