HTML
<img alt="image" th:src="'createFolw?photoId='+${photoId}+'&width=540&height=320'" >
现在了解到这能以这种方式来设置图片大小
controller
@RequestMapping("createFolw")
public void createFolw(HttpServletRequest request, HttpServletResponse response)throws Exception {
Long photoId=RequestUtil.getLong(request,"photoId",0L);
int width = RequestUtil.getInt(request, "width");
int height = RequestUtil.getInt(request, "height");
UpPhoto photoInfo = upPhotoService.getById(photoId);
HttpSession seesion = request.getSession();
byte[] data = photoInfo.getFileStream();
if (width != 0 && height != 0) {
data =upPhotoService.scaleImage(data, width, height);
}
response.setContentType("img/jpg");
response.setCharacterEncoding("utf-8");
try {
OutputStream outputStream =