From e04b28bc07bf773938c3521bcfc96c70c29fa60f Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期五, 02 一月 2026 17:16:42 +0800
Subject: [PATCH] 修改bug
---
ruoyi-admin/pom.xml | 7 +++
ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java | 2 +
zhang-content/src/main/java/com/ruoyi/service/impl/VideoProcessService.java | 48 +++---------------------
zhang-content/pom.xml | 9 ++++
4 files changed, 24 insertions(+), 42 deletions(-)
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index e128caf..3c2856d 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -128,6 +128,13 @@
<version>2.4.6</version>
<scope>runtime</scope>
</dependency>
+ <!-- 瀵逛簬Linux鏈嶅姟鍣� -->
+ <dependency>
+ <groupId>ws.schild</groupId>
+ <artifactId>jave-native-linux64</artifactId>
+ <version>2.4.6</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
index 1b01eba..26f2dfe 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
@@ -36,6 +36,8 @@
"localhost",
8087,
+
+
"http"
)
diff --git a/zhang-content/pom.xml b/zhang-content/pom.xml
index 09b5fce..938b663 100644
--- a/zhang-content/pom.xml
+++ b/zhang-content/pom.xml
@@ -119,6 +119,15 @@
<scope>runtime</scope>
</dependency>
+ <!-- 瀵逛簬Linux鏈嶅姟鍣� -->
+ <dependency>
+ <groupId>ws.schild</groupId>
+ <artifactId>jave-native-linux64</artifactId>
+ <version>2.4.6</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
</dependencies>
<build>
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/VideoProcessService.java b/zhang-content/src/main/java/com/ruoyi/service/impl/VideoProcessService.java
index 199569a..1b60a01 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/VideoProcessService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/VideoProcessService.java
@@ -233,50 +233,14 @@
// PNG鐨勫帇缂╃骇鍒紙0-9锛�0鏈�蹇絾鍘嬬缉鐜囦綆锛�9鏈�鎱絾鍘嬬缉鐜囬珮锛�
if (compressionLevel >= 0) {
- try {
- // 鍏堟鏌ユ槸鍚︽敮鎸佸帇缂╂ā寮�
- if (param.canWriteCompressed()) {
- param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
-
- // 妫�鏌ユ槸鍚︽敮鎸佸帇缂╃被鍨嬭缃�
- String[] compressionTypes = param.getCompressionTypes();
- if (compressionTypes != null && compressionTypes.length > 0) {
- // 灏濊瘯璁剧疆鍘嬬缉绫诲瀷
- String compressionType = compressionTypes[0];
- for (String type : compressionTypes) {
- if ("Deflate".equalsIgnoreCase(type) || "PNG".equalsIgnoreCase(type)) {
- compressionType = type;
- break;
- }
- }
- param.setCompressionType(compressionType);
- }
-
- // 璁剧疆鍘嬬缉璐ㄩ噺锛堝帇缂╃骇鍒浆鎹负0.0-1.0锛�
- float quality = Math.max(0.0f, Math.min(1.0f, compressionLevel / 9.0f));
- param.setCompressionQuality(quality);
- } else {
- // 濡傛灉涓嶆敮鎸佸帇缂╂ā寮忥紝璁板綍璀﹀憡骞剁户缁娇鐢ㄩ粯璁よ缃�
- log.warn("PNG缂栫爜鍣ㄤ笉鏀寔鍘嬬缉妯″紡锛屼娇鐢ㄩ粯璁よ缃�");
- }
- } catch (UnsupportedOperationException e) {
- // 鎹曡幏寮傚父锛岃褰曡鍛婏紝鐒跺悗浣跨敤榛樿璁剧疆缁х画
- log.warn("璁剧疆PNG鍘嬬缉鍙傛暟澶辫触: {}锛屼娇鐢ㄩ粯璁よ缃�", e.getMessage());
- // 閲嶇疆鍙傛暟涓洪粯璁ゅ��
- param = writer.getDefaultWriteParam();
- }
+ param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+ param.setCompressionType("Deflate");
+ param.setCompressionQuality(Math.max(0.0f, Math.min(1.0f, compressionLevel / 9.0f)));
}
- try {
- writer.setOutput(new MemoryCacheImageOutputStream(output));
- writer.write(null, new IIOImage(image, null, null), param);
- } catch (Exception e) {
- log.warn("浣跨敤ImageWriter鍐欏叆PNG澶辫触: {}锛屽洖閫�鍒癐mageIO.write", e.getMessage());
- // 鍥為��鍒扮畝鍗曠殑ImageIO.write
- ImageIO.write(image, "png", output);
- } finally {
- writer.dispose();
- }
+ writer.setOutput(new MemoryCacheImageOutputStream(output));
+ writer.write(null, new IIOImage(image, null, null), param);
+ writer.dispose();
}
--
Gitblit v1.9.1