ext = FilenameUtils.getExtension(file.getName());
}
BufferedImage orgImg = ImageIO.read(file);
// save original avatar file
String resId = imageService.put(file);
Resource res = new Resource();
res.setOrgSize(new Integer[]{ orgImg.getHeight(), orgImg.getWidth() });
res.setResId(resId);
res.setExt(ext);
resourceRepository.save(res);
signInUser.setAvatarOrg(res);
// save avatar file
BufferedImage avatarImg = orgImg.getSubimage(formBean.getX(),
formBean.getY(), formBean.getW(), formBean.getH());
ImageIO.write(avatarImg, ext, file);
resId = imageService.put(file);
res = new Resource();
res.setOrgSize(new Integer[] { avatarImg.getHeight(), avatarImg.getWidth() });
res.setResId(resId);
res.setExt(ext);
resourceRepository.save(res);
signInUser.setAvatar(res);
userRepository.save(signInUser);
} catch (Exception e) {
return new AjaxResult(AjaxResultCode.EXCEPTION, e.getMessage());