|
|
|
@ -1,16 +1,11 @@
|
|
|
|
package com.emr.controller;
|
|
|
|
package com.emr.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.emr.util.ExceptionPrintUtil;
|
|
|
|
import com.emr.util.ExceptionPrintUtil;
|
|
|
|
import com.sun.media.jai.codec.ImageCodec;
|
|
|
|
|
|
|
|
import com.sun.media.jai.codec.ImageEncoder;
|
|
|
|
|
|
|
|
import com.sun.media.jai.codec.JPEGEncodeParam;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
import javax.media.jai.JAI;
|
|
|
|
|
|
|
|
import javax.media.jai.RenderedOp;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
|
@ -44,7 +39,7 @@ public class ImageController{
|
|
|
|
boolean flag = checkJpg(file);
|
|
|
|
boolean flag = checkJpg(file);
|
|
|
|
if (!flag) {
|
|
|
|
if (!flag) {
|
|
|
|
//tif转jpg输出到前台
|
|
|
|
//tif转jpg输出到前台
|
|
|
|
tiffTuanJPG(response.getOutputStream(), file);
|
|
|
|
//tiffTuanJPG(response.getOutputStream(), file);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//图片读取路径
|
|
|
|
//图片读取路径
|
|
|
|
in=new FileInputStream(file);
|
|
|
|
in=new FileInputStream(file);
|
|
|
|
@ -70,7 +65,7 @@ public class ImageController{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private static void tiffTuanJPG(OutputStream out,File fileTiff){
|
|
|
|
/*private static void tiffTuanJPG(OutputStream out,File fileTiff){
|
|
|
|
String filePath = fileTiff.getAbsolutePath();
|
|
|
|
String filePath = fileTiff.getAbsolutePath();
|
|
|
|
RenderedOp rd = JAI.create("fileload", filePath);//读取iff文件
|
|
|
|
RenderedOp rd = JAI.create("fileload", filePath);//读取iff文件
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -84,5 +79,5 @@ public class ImageController{
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
ExceptionPrintUtil.printException(e);
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|