Where I need to put one image (directory) to use in Image component?
tks
Where I need to put one image (directory) to use in Image component?
tks
Image accepts type of Resource. Implementations of Resource are:
https://vaadin.com/docs/-/part/framework/application/application-resources.html
Johannes,
I using springboot… and I try to put my image on
resources,
resources/static
resources/public
and when I try to insert in my image component the url dont work
Is it a maven project? If so you can put the image in src/main/resources/ an then use a ClassResource
In resources dir the file at least goes to target/classes and you can use ClassResource(“file.png”). I’m not sure what is path to be used with FileResource
Marco is maven project.
So at the prop SRC from Component image in Vaadin Designer I put ClassResource(“file.pgn”) ?? should work?
Dont work. when I hit enter, the value disappears, and dont show anything
I don’t use Vaadin Designer but, as stated in javadocs, if you create the resource as ClassResource(“file.png”) the resource is relative to the location of the UI class.
So if your UI is in package my.app then the image should be put in src/main/resources/my/app
You can also use ClassResource(MyComponent.class, “file.png”); in this case the resource should be but in same package as MyComponent class (always in src/main/resources)
HTH
Marco