<img src="http://127.0.0.1:8081/t1/img">
@GetMapping("/img") @SneakyThrows public void test01(HttpServletResponse response){ String jp = Jie截屏.jp(0, 0, 300, 200, "D:\\桌面文档\\123.png"); File ossObjectToFile = new File(jp); try(ServletOutputStream outputStream = response.getOutputStream(); FileInputStream fileInputStream = new FileInputStream(ossObjectToFile)){ response.addHeader("Content-Disposition", "attachment;filename=123.png"); response.setContentType("application/octet-stream"); IOUtils.copy(fileInputStream,outputStream); } }
标签:outputStream,回显,jp,html,new,FileInputStream,response,页面 From: https://www.cnblogs.com/qq376324789/p/18021024