简历照片问题处理
This commit is contained in:
parent
0c0226d62d
commit
92ceea58dc
|
|
@ -77,6 +77,7 @@ public class PersonnelResumePo {
|
|||
try {
|
||||
String outPutPath = GCONST.getRootPath() + "hrm" + File.separator + "import" + File.separator + "template" + File.separator
|
||||
+ manager.getImageFileName();
|
||||
|
||||
File f = new File(outPutPath);
|
||||
if (!f.exists()) {
|
||||
String substring = outPutPath.substring(0, outPutPath.lastIndexOf(File.separator));
|
||||
|
|
@ -89,8 +90,9 @@ public class PersonnelResumePo {
|
|||
}
|
||||
}
|
||||
Thumbnails.of(inputStream).forceSize(100, 120).toFile(f);
|
||||
InputStream fileInputStream = Files.newInputStream(f.toPath());
|
||||
imageStr = "data:image/" + manager.getImageFileType() + ";base64," + Base64.getEncoder().encodeToString(IOUtils.toByteArray(fileInputStream));
|
||||
try (InputStream fileInputStream = Files.newInputStream(f.toPath())) { // 使用 try-with-resources 确保 fileInputStream 关闭
|
||||
imageStr = "data:image/" + manager.getImageFileType() + ";base64," + Base64.getEncoder().encodeToString(IOUtils.toByteArray(fileInputStream));
|
||||
}
|
||||
// 删除文件
|
||||
f.delete();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue