mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-04-05 17:37:49 +08:00
2.0版本
This commit is contained in:
parent
a663e99bcd
commit
3813f75f65
@ -12,7 +12,7 @@
|
||||
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>kkFileView</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>2.0</version>
|
||||
|
||||
|
||||
<properties>
|
||||
|
@ -4,4 +4,4 @@ cd "%KKFILEVIEW_BIN_FOLDER%"
|
||||
echo Using KKFILEVIEW_BIN_FOLDER %KKFILEVIEW_BIN_FOLDER%
|
||||
echo Starting kkFileView...
|
||||
echo Please check log file for more information
|
||||
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\conf\application.properties -jar kkFileView-0.1.jar -> ..\log\kkFileView.log
|
||||
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\conf\application.properties -jar kkFileView-2.0.jar -> ..\log\kkFileView.log
|
@ -27,4 +27,4 @@ else
|
||||
fi
|
||||
echo "Starting kkFileView..."
|
||||
echo "Please check log file for more information"
|
||||
nohup java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../conf/application.properties -jar kkFileView-0.1.jar > ../log/kkFileView.log 2>&1 &
|
||||
nohup java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../conf/application.properties -jar kkFileView-2.0.jar > ../log/kkFileView.log 2>&1 &
|
||||
|
@ -14,6 +14,7 @@ spring.freemarker.suffix = .ftl
|
||||
|
||||
server.tomcat.uri-encoding = UTF-8
|
||||
#文件上传限制
|
||||
spring.http.multipart.max-request-size=100MB
|
||||
spring.http.multipart.max-file-size=100MB
|
||||
|
||||
#文件资源路径(默认为打包根路径下的file目录下)
|
||||
|
@ -47,6 +47,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
||||
public String filePreviewHandle(String url, Model model) {
|
||||
// 预览Type,参数传了就取参数的,没传取系统默认
|
||||
String officePreviewType = model.asMap().get("officePreviewType") == null ? ConfigConstants.getOfficePreviewType() : model.asMap().get("officePreviewType").toString();
|
||||
String originUrl = model.asMap().get("originUrl").toString();
|
||||
FileAttribute fileAttribute=fileUtils.getFileAttribute(url);
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileName=fileAttribute.getName();
|
||||
@ -81,7 +82,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
||||
}
|
||||
}
|
||||
if (!isHtml && (OFFICE_PREVIEW_TYPE_IMAGE.equals(officePreviewType) || OFFICE_PREVIEW_TYPE_ALLIMAGES.equals(officePreviewType))) {
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, url);
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, originUrl);
|
||||
if (imageUrls == null || imageUrls.size() < 1) {
|
||||
model.addAttribute("msg", "office转图片异常,请联系管理员");
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
|
@ -40,6 +40,7 @@ public class PdfFilePreviewImpl implements FilePreview{
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileName=fileAttribute.getName();
|
||||
String officePreviewType = model.asMap().get("officePreviewType") == null ? "" : model.asMap().get("officePreviewType").toString();
|
||||
String originUrl = model.asMap().get("originUrl").toString();
|
||||
model.addAttribute("pdfUrl", url);
|
||||
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "pdf";
|
||||
String outFilePath = fileDir + pdfName;
|
||||
@ -54,7 +55,7 @@ public class PdfFilePreviewImpl implements FilePreview{
|
||||
}
|
||||
outFilePath = response.getContent();
|
||||
}
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, url);
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, originUrl);
|
||||
if (imageUrls == null || imageUrls.size() < 1) {
|
||||
model.addAttribute("msg", "pdf转图片异常,请联系管理员");
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
|
@ -46,6 +46,7 @@ public class OnlinePreviewController {
|
||||
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
||||
req.setAttribute("fileKey", req.getParameter("fileKey"));
|
||||
model.addAttribute("officePreviewType", req.getParameter("officePreviewType"));
|
||||
model.addAttribute("originUrl",req.getRequestURL().toString());
|
||||
FilePreview filePreview = previewFactory.get(url);
|
||||
return filePreview.filePreviewHandle(url, model);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
<id>make-assembly</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
<format>tar</format>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
Loading…
Reference in New Issue
Block a user