From b041775dae4438e428d2b70d2b22cfe8c49844fe Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 19 七月 2022 16:22:36 +0800
Subject: [PATCH] 1. 巡查汇总报告功能编写基本完成

---
 src/main/kotlin/cn/flightfeather/supervision/common/utils/FileUtil.kt |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/FileUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/FileUtil.kt
index 2cd72f0..f96d545 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/FileUtil.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/FileUtil.kt
@@ -1,10 +1,10 @@
 package cn.flightfeather.supervision.common.utils
 
-import java.io.File
-import java.io.FileOutputStream
-import java.io.FileInputStream
-
-
+import java.awt.Image
+import java.awt.image.BufferedImage
+import java.io.*
+import java.util.*
+import javax.imageio.ImageIO
 
 
 object FileUtil {
@@ -116,4 +116,32 @@
 
         }
     }
+
+    /**
+     * 鎸夌収鍥哄畾瀹藉害鍘嬬缉鍥剧墖鑷砨ase64褰㈠紡
+     */
+//    fun compressImage2(bytes: ByteArray): String {
+//        val length = 1440//鍥剧墖闀胯竟鍥哄畾鍘嬬缉涓�1440鍍忕礌
+//
+//        val input = ByteArrayInputStream(bytes)
+//        val srcImg = ImageIO.read(input)
+//        var srcLong = 0
+//        var srcShort = 0
+//        if (srcImg.width <= srcImg.height) {
+//            srcLong = srcImg.height
+//            srcShort = srcImg.width
+//
+//        } else {
+//
+//        }
+//        val scale = w.toFloat() / srcW
+//        val h = (srcImg.height * scale).toInt()
+//
+//        val buffImg = BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB)
+//        buffImg.graphics.drawImage(srcImg.getScaledInstance(w, h, Image.SCALE_SMOOTH), 0, 0, null)
+//        val out = ByteArrayOutputStream()
+//        ImageIO.write(buffImg, "PNG", out)
+//
+//        return SCHEME_PNG + Base64.getEncoder().encodeToString(out.toByteArray())
+//    }
 }
\ No newline at end of file

--
Gitblit v1.9.3