code: @RequestMapping(value = "/getThumbnail.action", method = RequestMethod.GET)
      public ResponseEntity<?> getThumbnail(@RequestParam Integer id) {
  
          final HttpHeaders responseHeaders = new HttpHeaders();
          Map<String, Object> responseMap;
  
          try {
              // try to get the image
              ImageFile image = service.findById(id);
              if (image == null) {
                  throw new Exception("Could not find the image with id " + id);
              }
  
              byte[] imageBytes = null;
  
              imageBytes = image.getThumbnail();
  
              responseHeaders.setContentType(
                  MediaType.parseMediaType(image.getFileType()));
  
              LOG.info("Successfully got the image thumbnail " +
                  image.getFileName());
  
              return new ResponseEntity<byte[]>(
                  imageBytes, responseHeaders, HttpStatus.OK);
          } catch (Exception e) {
              final String errorMessage = "Could not get the image thumbnail: "
                  + e.getMessage();
  
              LOG.error(errorMessage);
              responseMap = ResultSet.error(errorMessage);
  
              responseHeaders.setContentType(MediaType.APPLICATION_JSON);
  
              return new ResponseEntity<Map<String, Object>>(
                  responseMap, responseHeaders, HttpStatus.OK);
          }
      }
docs: Gets an image from the database by the given id