You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
The integration of cropperjs in vaadin is amazing.
There is 1 small thing that I am not able to do and I am not sure if it is a missing feature or I can't correctly set it up.
The problem is that the cropped image has a default size of 4096x4096. What I want is when I crop an image to get its actual size from the original image - as it is shown in this demo https://fengyuanchen.github.io/cropperjs/ (when I resize the cropper the width and height seems to be the real ones.)
I've tried something and I am getting a result that is a bit strange for me. Here is my example:
-- My cropper definition (basicaly the same as the demo inside)
` Button cropButton = new Button("Crop");
CropperSettings cropperSettings = new CropperSettings();
cropperSettings.setViewMode(ViewMode.ONE);
cropperSettings.setModal(true);
cropperSettings.setAspectRatio(0.0);
cropperSettings.setCroppedImageHeight(1024);
cropperSettings.setCroppedImageWidth(1024);
Cropper crop =
new Cropper(
cropperSettings, java.util.Base64.getEncoder().encodeToString(os.toByteArray()), mimeType);
Button cancelButton = new Button("cancel", e -> dialog.close());
cropButton.addClickListener(
event -> {
dialog.close();
String imageUri = crop.getImageUri();
Image img = new Image();
img.setSrc(imageUri);
mainLayout.removeAll();
mainLayout.add(upload);
mainLayout.add(img);
});`
I am defining a cropped image size of (1024x1024) which works something like a max cropped image size. If I do not set these bounds it get 4096x4096.
Is it possible that after the crop I can get the actual image size instead of those hardcoded values.
Thanks in advance :)
The text was updated successfully, but these errors were encountered:
Hi there,
The integration of cropperjs in vaadin is amazing.
There is 1 small thing that I am not able to do and I am not sure if it is a missing feature or I can't correctly set it up.
The problem is that the cropped image has a default size of 4096x4096. What I want is when I crop an image to get its actual size from the original image - as it is shown in this demo https://fengyuanchen.github.io/cropperjs/ (when I resize the cropper the width and height seems to be the real ones.)
I've tried something and I am getting a result that is a bit strange for me. Here is my example:
-- My cropper definition (basicaly the same as the demo inside)
` Button cropButton = new Button("Crop");
I am defining a cropped image size of (1024x1024) which works something like a max cropped image size. If I do not set these bounds it get 4096x4096.
Is it possible that after the crop I can get the actual image size instead of those hardcoded values.
Thanks in advance :)
The text was updated successfully, but these errors were encountered: