Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 如何向thymeleaf添加图像_Spring_Thymeleaf - Fatal编程技术网

Spring 如何向thymeleaf添加图像

Spring 如何向thymeleaf添加图像,spring,thymeleaf,Spring,Thymeleaf,如何将templates/image/valyaev.png文件夹中的图像添加到thymeleaf,请使用多个选项,但图像本身不会显示,只会显示图像的轮廓或只显示一个勾号 我可以使用addInline添加它,但我无法对图像执行任何操作,因此我想通过thymeleaf本身添加,为什么不将其复制到路径static/images中,然后使用以下语句: <img th:src="@{/images/valayev.jpg}" 有时thymeleaf不采用静态映像路径,在这种情况下,使用该映

如何将templates/image/valyaev.png文件夹中的图像添加到thymeleaf,请使用多个选项,但图像本身不会显示,只会显示图像的轮廓或只显示一个勾号


我可以使用addInline添加它,但我无法对图像执行任何操作,因此我想通过thymeleaf本身添加,为什么不将其复制到路径static/images中,然后使用以下语句:

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

有时thymeleaf不采用静态映像路径,在这种情况下,使用该映像的基64

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

如果将其添加到static,需要设置路径@{/static/images/valayev.jpg}?那有什么不同呢?不,用上面的陈述就行了。它会自动在静态文件夹中查找图像文件夹。不管怎样,图像属于“静态”的。