图片上传 用户名+时间戳保证唯一性 jituan_20180202112233.jpg

在图片前要加上groupId_personId_才可以唯一匹配为该用户的图片

http://192.168.2.227:8080/huikeportal/inspectionsImg/groupId_personId_20180202112233.jpg


base64要进行截取imgBate64Str.substring(22),即从/9开始往后

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD


String realPath = request.getSession().getServletContext().getRealPath("/img");


图片上传到了target目录下的huikeportal\img
D:\code\huikeportal\target\huikeportal\img


替换成/斜杠以后的地址
D:/code/huikeportal/target/huikeportal/img




http://192.168.2.227:8080/D:\code\huikeportal\target\huikeportal\img/20171205114549.jpg




http://192.168.2.227:8080/D:/code/huikeportal/target/huikeportal/img/20171205115712.jpg




数据库存的url
http://192.168.2.227:8080/d:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/huikeportal/img/20171205133250.jpg
访问如下连接可以拿到图片


http://192.168.2.227:8080/huikeportal/img/20171205133250.jpg






"thumbnailsImg" -> "thumbnailhttp://192.168.2.227:8080/huikeportal/inspectionsImg/20171205171645.jpg"


http://192.168.2.227:8080/huikeportal/inspectionsImg/20171205171645.jpg






concat(SUBSTRING_INDEX(rec.picture,'/',5),'/thumbnail',SELECT SUBSTRING_INDEX(rec.picture,'/',-1))




SELECT concat(SUBSTRING_INDEX('http://192.168.2.227:8080/huikeportal/inspectionsImg/20171205171645.jpg','/',5),'/thumbnail',SUBSTRING_INDEX('http://192.168.2.227:8080/huikeportal/inspectionsImg/20171205171645.jpg','/',-1))


配置文件info.properties
inspectionRecordFilePath=inspectionsImg
imageServer=http://192.168.2.227:8080/

猜你喜欢

转载自blog.csdn.net/qq_29883183/article/details/79655893