@RequestMapping(
      value = "/{id}/height/{height}",
      method = RequestMethod.GET,
      produces = MediaType.IMAGE_JPEG_VALUE)
  public byte[] getImageWithHeight(@PathVariable int id, @PathVariable int height)
      throws IOException {
    VehicleImageRaw image = imageRepository.findOne(id);

    byte[] imageData = image.getImageData();

    ByteArrayInputStream bais = new ByteArrayInputStream(imageData);
    BufferedImage bufferedImage = ImageIO.read(bais);

    // int width = bufferedImage.getHeight() / bufferedImage.getWidth() * height;

    double ratio = 1.0 * bufferedImage.getWidth() / bufferedImage.getHeight();
    Double width = height * ratio;

    BufferedImage bufferedResizedImage =
        Scalr.resize(
            bufferedImage,
            Scalr.Method.BALANCED,
            Scalr.Mode.AUTOMATIC,
            width.intValue(),
            height); // 400,300 was the size we expected

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    ImageIO.write(bufferedResizedImage, "jpg", baos);
    baos.flush();

    return baos.toByteArray();
  }
  @RequestMapping(
      value = "/{id}",
      method = RequestMethod.GET,
      produces = MediaType.IMAGE_JPEG_VALUE)
  public byte[] getVehicle(@PathVariable int id) throws IOException {
    VehicleImageRaw image = imageRepository.findOne(id);

    return image.getImageData();
  }