I am inserting an image from file into a UI. I am creating it in Vaadin 7.6.8 by following these instructions.
String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
FileResource resource = new FileResource(new File(basepath + "/WEB-INF/images/image.png"));
Image image = new Image("", resource);
However I am unable to rescale or resize the image at all. The image is always being displayed in full size.
Is there a way that I can scale down the image without using CSS ?
You can specify height and width of the image component,
FileResource resource = new FileResource(new File("D:/image.jpg"));
Image image = new Image("", resource);
image.setWidth(200, Unit.PIXELS);
image.setHeight(200, Unit.PIXELS);