Commit 96460008 authored by keita.onoguchi's avatar keita.onoguchi

一覧表示画面途中

parent fcb099e8
......@@ -67,7 +67,8 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
......
......@@ -55,7 +55,6 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
......@@ -28,4 +28,6 @@ public class Shoes {
private Integer Size;
@Column(nullable=false)
private Integer productStatus;
@Column(nullable=false)
private String path;
}
package com.example.web;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Iterator;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
import javax.imageio.stream.ImageOutputStream;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.example.domain.Shoes;
import com.example.domain.User;
import com.example.service.LoginUser;
......@@ -25,4 +42,53 @@ public class EcsiteController {
public String list() {
return "Hello world";
}
//画像登録用
// @PostMapping("admin/management/shoes")
// public String CreateShoes(@Validated,
// MultipartFile multipartFile) throws Exception {
//
// if (!multipartFile.isEmpty()) {
// try {
// // ファイル名をリネイム
// File oldFileName = new File(multipartFile.getOriginalFilename());
// File newFileName = new File(oldFileName + ".jpg");
// oldFileName.renameTo(newFileName);
//
// // 保存先を定義
// String uploadPath = "src/main/resources/static/upload/";
// byte[] bytes = multipartFile.getBytes();
//
// // 指定ファイルへ読み込みファイルを書き込み
// BufferedOutputStream stream = new BufferedOutputStream(
// new FileOutputStream(new File(uploadPath + newFileName)));
// stream.write(bytes);
// stream.close();
//
// // 圧縮
// File input = new File(uploadPath + newFileName);
// BufferedImage image = ImageIO.read(input);
// OutputStream os = new FileOutputStream(input);
// Iterator<ImageWriter> writers = ImageIO
// .getImageWritersByFormatName("jpg");
// ImageWriter writer = (ImageWriter) writers.next();
// ImageOutputStream ios = ImageIO.createImageOutputStream(os);
// writer.setOutput(ios);
// ImageWriteParam param = new JPEGImageWriteParam(null);
// param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
// param.setCompressionQuality(0.30f);
// writer.write(null, new IIOImage(image, null, null), param);
// os.close();
// ios.close();
// writer.dispose();
//
// // DBに写真の名前を格納する
// service.updatePhoto(account.getUsername(), newFileName.toString());
//
// } catch (Exception e) {
// System.out.println(e);
// }
// }
// return "forward:/top";
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment