diff --git a/VamPa/pom.xml b/VamPa/pom.xml
index 85d827a..6f9cd27 100644
--- a/VamPa/pom.xml
+++ b/VamPa/pom.xml
@@ -231,6 +231,14 @@
jackson-databind
2.12.1
+
+
+
+ net.coobird
+ thumbnailator
+ 0.4.13
+
+
diff --git a/VamPa/src/main/java/com/vam/controller/AdminController.java b/VamPa/src/main/java/com/vam/controller/AdminController.java
index ed35268..4f110bb 100644
--- a/VamPa/src/main/java/com/vam/controller/AdminController.java
+++ b/VamPa/src/main/java/com/vam/controller/AdminController.java
@@ -1,9 +1,7 @@
package com.vam.controller;
-import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
-import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -32,6 +30,8 @@ import com.vam.model.PageDTO;
import com.vam.service.AdminService;
import com.vam.service.AuthorService;
+import net.coobird.thumbnailator.Thumbnails;
+
@Controller
@RequestMapping("/admin")
public class AdminController {
@@ -314,16 +314,42 @@ public class AdminController {
multipartFile.transferTo(saveFile);
/* 썸네일 생성(ImageIO) */
- File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
+ /*
+ File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
BufferedImage bo_image = ImageIO.read(saveFile);
- BufferedImage bt_image = new BufferedImage(300, 500, BufferedImage.TYPE_3BYTE_BGR);
+
+ //비율
+ double ratio = 3;
+ //넓이 높이
+ int width = (int) (bo_image.getWidth() / ratio);
+ int height = (int) (bo_image.getHeight() / ratio);
+
+ BufferedImage bt_image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
Graphics2D graphic = bt_image.createGraphics();
- graphic.drawImage(bo_image, 0, 0,300,500, null);
+ graphic.drawImage(bo_image, 0, 0,width,height, null);
ImageIO.write(bt_image, "jpg", thumbnailFile);
+ */
+
+ /* 방법 2 */
+ File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
+
+ BufferedImage bo_image = ImageIO.read(saveFile);
+
+ //비율
+ double ratio = 3;
+ //넓이 높이
+ int width = (int) (bo_image.getWidth() / ratio);
+ int height = (int) (bo_image.getHeight() / ratio);
+
+
+ Thumbnails.of(saveFile)
+ .size(width, height)
+ .toFile(thumbnailFile);
+
} catch (Exception e) {
diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
index 90c1884..9116bcd 100644
--- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
+++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Thu May 13 02:59:13 KST 2021
+#Thu May 13 22:57:49 KST 2021
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa
m2e.projectName=VamPa
groupId=com.vam
diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
index 85d827a..6f9cd27 100644
--- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
+++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
@@ -231,6 +231,14 @@
jackson-databind
2.12.1
+
+
+
+ net.coobird
+ thumbnailator
+ 0.4.13
+
+
diff --git a/VamPa_MySQL/pom.xml b/VamPa_MySQL/pom.xml
index 8776c16..595ac75 100644
--- a/VamPa_MySQL/pom.xml
+++ b/VamPa_MySQL/pom.xml
@@ -230,6 +230,13 @@
com.fasterxml.jackson.core
jackson-databind
2.12.1
+
+
+
+
+ net.coobird
+ thumbnailator
+ 0.4.13
diff --git a/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java b/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
index 098af60..2fbd2e1 100644
--- a/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
+++ b/VamPa_MySQL/src/main/java/com/vam/controller/AdminController.java
@@ -31,6 +31,8 @@ import com.vam.model.PageDTO;
import com.vam.service.AdminService;
import com.vam.service.AuthorService;
+import net.coobird.thumbnailator.Thumbnails;
+
@Controller
@RequestMapping("/admin")
public class AdminController {
@@ -311,20 +313,46 @@ public class AdminController {
/* 파일 저장 */
try {
-
+
multipartFile.transferTo(saveFile);
-
+
/* 썸네일 생성(ImageIO) */
- File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
+ /*
+ File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
BufferedImage bo_image = ImageIO.read(saveFile);
- BufferedImage bt_image = new BufferedImage(300, 500, BufferedImage.TYPE_3BYTE_BGR);
+
+ //비율
+ double ratio = 3;
+ //넓이 높이
+ int width = (int) (bo_image.getWidth() / ratio);
+ int height = (int) (bo_image.getHeight() / ratio);
+
+ BufferedImage bt_image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
Graphics2D graphic = bt_image.createGraphics();
- graphic.drawImage(bo_image, 0, 0,300,500, null);
+ graphic.drawImage(bo_image, 0, 0,width,height, null);
+
+ ImageIO.write(bt_image, "jpg", thumbnailFile);
+ */
+
+ /* 방법 2 */
+ File thumbnailFile = new File(uploadPath, "s_" + uploadFileName);
+
+ BufferedImage bo_image = ImageIO.read(saveFile);
+
+ //비율
+ double ratio = 3;
+ //넓이 높이
+ int width = (int) (bo_image.getWidth() / ratio);
+ int height = (int) (bo_image.getHeight() / ratio);
+
+
+ Thumbnails.of(saveFile)
+ .size(width, height)
+ .toFile(thumbnailFile);
- ImageIO.write(bt_image, "jpg", thumbnailFile);
} catch (Exception e) {
diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
index 49340e6..5b02b3a 100644
--- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
+++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Thu May 13 02:59:11 KST 2021
+#Thu May 13 23:16:50 KST 2021
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa_MySQL
m2e.projectName=VamPa_MySQL
groupId=com.vam
diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
index 8776c16..595ac75 100644
--- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
+++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml
@@ -230,6 +230,13 @@
com.fasterxml.jackson.core
jackson-databind
2.12.1
+
+
+
+
+ net.coobird
+ thumbnailator
+ 0.4.13