Upload - camera : only landscape support

I use the Upload component to get an image (through the camera if it’s a mobile device) from the user:

MemoryBuffer imageBuffer = new MemoryBuffer();
Upload imageUpload = new Upload(imageBuffer);
imageUpload.setAcceptedFileTypes("image/jpeg");
imageUpload.getElement().setProperty("capture", "environment");
imageUpload.addSucceededListener(
	new ComponentEventListener<SucceededEvent>() {
		@Override
		public void onComponentEvent(SucceededEvent event) {
			try {
				BufferedImage bsrc = ImageIO.read(imageBuffer.getInputStream());
				System.out.println("image width: " + bsrc.getWidth() + " px, height: " + bsrc.getHeight() + " px");
			} catch (IOException e) {
				e.printStackTrace();
			}	
		}
	});							

However, no matter how I access this application on a non-mobile (Windows laptop) or mobile (Android phone), each image that is uploaded (from a file or taken with the camera) is interpreted as a landscape image. This means that if it’s a landscape image, the printed width and height is correct, but if it’s a portrait, the width and height are mixed up. And when showing the uploaded (portrait) image in an img tag like this:

<img src="data:image/jpg;base64,[[imageBytes]
]">

the portrait image is displayed wrong (90 degree rotated).

Anybody an idea if there’s a method to get the type (portrait/landscape) of the uploaded image?
Or another approach to correctly interpret the uploaded image?

Thanks!