I have an option in my CUBA application to upload employee image. Surprisingly, the image is not displayed straight most of the time randomly and need to rotate to the proper direction.
Here is my code:
//employee image
//=======================
employeeImageUpload.addFileUploadSucceedListener(event -> {
FileDescriptor fd = employeeImageUpload.getFileDescriptor();
try {
fileUploadingAPI.putFileIntoStorage(employeeImageUpload.getFileId(), fd);
} catch (FileStorageException e) {
throw new RuntimeException("Error saving file to FileStorage", e);
}
FileDescriptor committedImage = dataSupplier.commit(fd);
((Employee) getItem()).setImage(committedImage);
FileDataProvider dataProvider = new FileDataProvider(committedImage);
employeeImage.setSource(committedImage.getId() + "." + committedImage.getExtension(), dataProvider);
showNotification(formatMessage(getMessage("uploadSuccessMessage"), employeeImageUpload.getFileName()),
NotificationType.HUMANIZED);
});
How can I rotate right, left etc?