|
@@ -11,6 +11,9 @@ import org.springframework.ui.Model;
|
|
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 java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 图片预览Controller
|
|
* 图片预览Controller
|
|
* @author 付光裕
|
|
* @author 付光裕
|
|
@@ -24,19 +27,23 @@ public class PicturePreviewController extends BaseController {
|
|
/**
|
|
/**
|
|
* 阿里云文件服务器前缀
|
|
* 阿里云文件服务器前缀
|
|
*/
|
|
*/
|
|
- private static final String aliyunOssPrefix = "http://"+ Global.getConfig("bucketName") + "." + Global.getConfig("ossPrefix");
|
|
|
|
|
|
+ private static final String aliyunOssPrefix = "http://";
|
|
|
|
|
|
|
|
|
|
@RequestMapping("picturePreview")
|
|
@RequestMapping("picturePreview")
|
|
public String picturePreview(@RequestParam("url")String url, Model model){
|
|
public String picturePreview(@RequestParam("url")String url, Model model){
|
|
if("2".equals(uploadMode)){
|
|
if("2".equals(uploadMode)){
|
|
- if(url.indexOf(aliyunOssPrefix)!=-1){
|
|
|
|
- url = url.replace(aliyunOssPrefix,"");
|
|
|
|
|
|
+ //去除掉http前缀
|
|
|
|
+ if(url.indexOf("http://")!=-1){
|
|
|
|
+ url = url.replace("http://","");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ int i = url.indexOf("/");
|
|
|
|
+ url = url.substring(i,url.length());
|
|
|
|
+ url = url.substring(0,url.lastIndexOf("?"));
|
|
|
|
+ url = aliyunUrl + url;
|
|
|
|
+ url = new OSSClientUtil().getFileTemporaryLookUrl(url);
|
|
}
|
|
}
|
|
- url = url.substring(0,url.lastIndexOf("?"));
|
|
|
|
- url = aliyunUrl + url;
|
|
|
|
- url = new OSSClientUtil().getFileTemporaryLookUrl(url);
|
|
|
|
model.addAttribute("url",url);
|
|
model.addAttribute("url",url);
|
|
return "modules/sys/picturePreview";
|
|
return "modules/sys/picturePreview";
|
|
}
|
|
}
|