Image component not load src

Hello,

i have a image tag with source that contain ‘/images/login-bg.svg’. The login-bg.svg is in src/main/resources/META-INF/resources/images. why do not load and show the image?

 <image resource="/images/login-bg.svg" width="500px" height="700px" alternateText="Login BG" />

Here is how I referenced an image in resources for the login screen. In other places I was only able to locate the image using the classpath option. This is with jmix 1.5.0 classic UI. My images are in src/main/resources/org/someone/membership/images.

<image id="welcomeImage" align="MIDDLE_CENTER" scaleMode="CONTAIN" height="120" width="160">
    <resource>
        <classpath path="org/someone/membership/images/Logo.png"/>
     </resource>
</image>

Thanks for your answer. But i use the flowui version 1.5

I would not be surprised if classic and flow UI both use the same Resources loader behind the scenes. The main point of my suggestion was to try the classpath method of locating the image. For the code version I had to do this (below). Perhaps you could try the classpath: prefix, although it is difficult to troubleshoot because all you see is that it does not work. It is difficult to tell where it is looking for the resources.

Resource r = resources.getResource("classpath:org/someone/membership/images/Logo.png");

Hi,

Take a look at this forum topic, it should help.

Regards,
Gleb

1 Like

Hi @gorelov ,
thank you very much. that was the right solution.