【发布时间】:2019-08-28 15:57:17
【问题描述】:
我有一个模型类注册,其中我有一个照片属性,它保存照片的 URL,我的照片保存在根目录下的 images 文件夹中。
现在,当我尝试显示图像时,它没有显示图像,我已经交叉验证图像存在于那里。
我试过<img src="@item.Photo" width="100" height="100" />
@*<img src="@item.Photo" width="100" height="100" />*@
我也试过了
<img src="@Url.Content(@item.Photo)" height="25px" width="50px" />
我的路径变成了/imges/previous theme.jpg,即使在开始时添加~,它仍然没有显示结果,我的根目录上有图像文件夹,里面有以前的theme.jpg文件
它应该将结果显示为图像,即使在删除 url.Content 之后也是如此
<img src="@item.Photo" />
也不行。
【问题讨论】:
-
我建议检查图像是否将 BuildAction 设置为 CopyIfNewer 或 CopyAlways。
-
item.Photo包含哪些数据? -
什么是渲染的 HTML 输出?
-
item.Photo 包含来自 DB 的 URL,并且相同的 URL 存在于项目目录中 ~/imges/previous theme.jpg
标签: asp.net-mvc image