/** * 显示原图片 * @param name 加密图片resourceUrl * @param response * @throws Exception */ @RequestMapping(method=RequestMethod.GET , value ="/image/original/{name}") public void preview(@PathVariable String name,HttpServletResponse response) throws Exception { String imagePath = Base64Util.decodeBase64(name); File file = new File(imageServerDirectory + imagePath); response.setContentType("image/jpeg;charset=UTF-8"); OutputStream output = response.getOutputStream(); InputStream in = IOUtils.toBufferedInputStream(new FileInputStream(file)); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) != -1) { output.write(buffer, 0, length); } in.close(); }
显示原图片
猜你喜欢
转载自kangcaiyuan.iteye.com/blog/2347970
今日推荐
周排行