@RequestMapping(value = "/thumb/{courseId}", method = RequestMethod.GET) public void readthumb( @PathVariable int courseId, String width, String height, HttpServletResponse response) { Course course = courseDao.getCourse(courseId); String imagePath = course.getImageUrl(); // PathUtils.readPhoto(imagePath, response); MagickPic magickPic = new MagickPic(); byte[] bytes = magickPic.scaleImage(imagePath, width, height); try { OutputStream os = response.getOutputStream(); os.write(bytes); os.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@RequestMapping(value = "/photo/{courseId}", method = RequestMethod.GET) public void readPhotos(@PathVariable int courseId, HttpServletResponse response) { Course course = courseDao.getCourse(courseId); String imagePath = course.getImageUrl(); PathUtils.readPhoto(imagePath, response); }