How to add an image to thymeleaf

How to add an image from the templates / image / valyaev.png folder to thymeleaf, use several options, but the image itself does not appear, only the outline of the image or just a tick appears

enter image description here

I can add it using addInline, but I cannot perform any operations on the image, so I want to add through thymeleaf itself

Upvotes: 2

Views: 9531

Answers (2)

Gaurav Jestha
Gaurav Jestha

Reputation: 30

Sometimes thymeleaf does not take static image path ,in that case use base 64 of that image.

<img th:src="@{data:image/png;base64,YOUR IMAGE BASE 64}

Upvotes: 2

XDAF
XDAF

Reputation: 374

Why don't you copy it in the path static/images and then use the following statement:

<img 
th:src="@{/images/valayev.jpg}" 

Upvotes: 2

Related Questions