在html img标签的spring框架中从本地目录插入图像(spring boot)

时间:2018-09-11 06:52:48

标签: html spring maven spring-mvc spring-boot

我正在尝试从本地目录中插入图像 resources文件夹,完整路径为resources\images\logo-2.png

enter image description here

我的动态html是<img src="resources/images/logo-2.png" alt="logo">

在我的最终输出中,它给了我

<img src="https://ci3.googleusercontent.com/proxy/2uoPI9RTChl3eYeKfRBGfR4AtNAs6Xuk5rrSPz9dDmyyXgeq4dj_pxg9VWqI4lhsiL60IRKAjnw=s0-d-e1-ft#http://resources/images/logo-2.png" alt="logo" class="CToWUd">

我不知道初始URL是什么,但我没有从路径中获取图像。

1 个答案:

答案 0 :(得分:0)

您总是可以尝试使用IP地址作为路由外包吗?

<img src="http://192.0.0.1/resources/images/logo-2.png" alt="logo"> //将192.0.0.1更改为您的本地路由。

根据您设置网络服务器的方式,它可能不支持本地转换到目录。