我在我的页面中遇到了图像的问题。在我的数据库中,我提到了如下图像路径:
"/images/smallimages/sandal1.png "它工作正常,并在我的本地主机上的视图中显示图像,但在将代码上传到服务器后,图像不显示。是否需要在图像URL中放置代字号(~)?我绑定的图片路径如下:
<a href="@Html.DisplayFor(m=>m.larImagePath1)" class="MagicZoom" id="Zoomer" rel="selectors-effect-speed:100">
<img src="@Html.DisplayFor(m=>m.medImagePath1)" /></a><br/>
<!-- selector with own title -->
<a href="@Html.DisplayFor(m=>m.larImagePath1)" rel="zoom-id:Zoomer;" rev="@Html.DisplayFor(m=>m.medImagePath1)">
<img src="@Html.DisplayFor(m=>m.smaImagePath1)"/></a>
<!-- selector without title and with own zoom window size -->
<a href="@Html.DisplayFor(m=>m.larImagePath2)" rel="zoom-id:Zoomer;selectors-effect-speed: 200" rev="@Html.DisplayFor(m=>m.medImagePath2)">
<img src="@Html.DisplayFor(m=>m.smaImagePath2)"/></a>发布于 2013-09-16 20:16:51
您应该为图像URL使用Url.Content帮助器,如下所示:
<img src='@Url.Content("~" + Model.smaImagePath1)' />https://stackoverflow.com/questions/18827514
复制相似问题