|
|
@@ -143,12 +143,6 @@ public class _AttachmentController extends JBaseCRUDController<Attachment> {
|
|
|
String webRoot = PathKit.getWebRootPath();
|
|
|
String requestUrlMessage = this.getRequest().getScheme() +"://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort();
|
|
|
Attachment attachment = AttachmentQuery.me().findById(getParaToBigInteger("sourceId"));
|
|
|
- int x1 = getParaToInt("x1");
|
|
|
- int x2 = getParaToInt("x2");
|
|
|
- int y1 = getParaToInt("y1");
|
|
|
- int y2 = getParaToInt("y2");
|
|
|
- int width = x2 - x1;
|
|
|
- int height = y2 - y1;
|
|
|
String srcpath = requestUrlMessage + "/jpress" + attachment.getPath();
|
|
|
String type = attachment.getSuffix().substring(1);
|
|
|
//新截取的图片名称在原图名称上加上时间戳
|
|
|
@@ -157,10 +151,24 @@ public class _AttachmentController extends JBaseCRUDController<Attachment> {
|
|
|
String subpath = requestUrlMessage + "/jpress" + "/attachment/" + time + attachment.getSuffix();
|
|
|
/*srcpath.replaceAll("/","-");*/
|
|
|
BufferedImage bufferedImage = OperateImage.getIconInfo(srcpath);
|
|
|
+ double widthRate = bufferedImage.getWidth()*(1.0/160);
|
|
|
+ double heightRate = bufferedImage.getHeight()*(1.0/160);
|
|
|
+
|
|
|
+
|
|
|
+ int x1 = (int)(getParaToInt("x1") * widthRate);
|
|
|
+ int x2 = (int)(getParaToInt("x2") * widthRate);
|
|
|
+ int y1 = (int)(getParaToInt("y1") * widthRate);
|
|
|
+ int y2 = (int)(getParaToInt("y2") * widthRate);
|
|
|
+ int width = x2 - x1;
|
|
|
+ int height = y2 - y1;
|
|
|
OperateImage o = new OperateImage(x1, y1, width, height);
|
|
|
//o.setSrcpath(srcpath);
|
|
|
o.setSourceImg(bufferedImage);
|
|
|
- o.setSubpath("D:\\pictest\\" + time + attachment.getSuffix() );
|
|
|
+ File file = new File("D:\\软文截图");
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdir();
|
|
|
+ }
|
|
|
+ o.setSubpath("D:\\软文截图\\" + time + attachment.getSuffix() );
|
|
|
try {
|
|
|
File cutImage = o.cut(type);
|
|
|
/*Attachment cutImage = new Attachment();
|