2013-09-16 27 views
0

我正面臨圖片在我的頁面中出現問題。在我的數據的基礎上,我提到像圖像路徑:帶「〜」符號的圖片錯誤

"/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> 

回答

0

你應該使用Url.Content幫手圖像的URL,就像這樣:

<img src='@Url.Content("~" + Model.smaImagePath1)' /> 
+0

我的漸近固定我self.And很好的解決方案。 – user2534261