@RequestMapping(value = "idCard/image/{imgId}", method = RequestMethod.GET)
public ResponseEntity<byte[]> queryCardImg(@PathVariable("imgId") String imgId, ModelMap model) {
ResponseEntity<byte[]> response = service.queryImgById(imgId);
return response;
}
@Override
public ResponseEntity<byte[]> queryImgById(String imgId) {
DocumentResource picDoc = this.resDao.selectDocumentResByResId(imgId);
String contentType = picDoc.getContentType();
byte[] picRes = picDoc.getContent();
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.parseMediaType(contentType));
ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(picRes, httpHeaders, HttpStatus.OK);
return response;
}
springmvc 获取图片处理方式
最新推荐文章于 2023-07-11 14:34:56 发布