Java Community | Help. Code. Learn.JC|HCL
Java Community | Help. Code. Learn.โ€ข2y agoโ€ข
21 replies
Sung

Thymeleaf / Loading image from DTO

Hello guys, I'm trying to make a profile manager for any user that is successfully identified, I can render every user datas in my template except for my image, in my inspector it says the image can't load

The image comes from my DTO and it's persisted in my database and I have implemented my getters and setters properly but I still don't know why it doesn't work.
In my browser it obviously shows Image de profil

Here's my code in my template :
 <h1 th:if="${user != null}">Profil de <span th:text="${user.firstName}"></span></h1>
    <h1 th:if="${user != null}">Profil de <span th:text="${user.lastName}"></span></h1>
    <h1 th:if="${user != null}">Profil de <span th:text="${user.email}"></span></h1>

    <div th:if="${user != null}">
        <img th:src="${user.image}" alt="Image de profil" width="400px"/>
    </div>

 <h1 th:if="${user == null}">Profil de <span th:text="${error}">User not found !!!</span></h1>
Was this page helpful?