zxl
16 小时以前 db9bf9ba63cf06bb088fff31272da73641938ba7
图片压缩
1个文件已修改
6 ■■■■ 已修改文件
ycl-server/src/main/java/com/ycl/task/ImageCompressTask.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/ImageCompressTask.java
@@ -171,7 +171,11 @@
            // ====================== 压缩逻辑结束 ======================
            // 写入临时文件并替换原文件
            tempFile = File.createTempFile("compressed_", "." + formatName);
            String tempFileName = "compressed_" + System.currentTimeMillis() + "." + formatName;
            tempFile = new File(localFile.getParentFile(), tempFileName); // 临时文件和原文件同目录
            log.info("临时文件路径:{},原文件路径:{}",
                    tempFile.getAbsolutePath(),
                    localFile.getAbsolutePath());
            try (OutputStream tempOs = new FileOutputStream(tempFile)) {
                byte[] buffer = new byte[1024];
                int len;