I want to display the photo through the Path which is saved on the database Like this \\94.19.247.273\C$\\t\q\laptop.com\bb\images\UrunImages\a1\14-09-18-_04-17-00.jpg . I have mothod to convert the path
\\94.19.247.273\C$\\t\q\laptop.com\bb\images\UrunImages\a1\14-09-18-_04-17-00.jpg
mothod
public FileContentResult ImagePath(string path) { string str1 = "C:/"; string str2 = "//94.19.247.273/C$//"; string result = path.Replace(str2, str1); byte[] imageArray = System.IO.File.ReadAllBytes(result); return new FileContentResult(imageArray, "image/png"); }
I get it from Stackoverflow and on the View like this
View
@foreach (var item in Model.ProductPhotoPathList) { <li data-thumb="@Url.Action("ImagePath","Home",new { path = item})"> <div class="thumb-image"> <img src="@Url.Action("ImagePath","Home",new { path = item})" data-imagezoom="true" class="img-responsive" alt=""> </div> </li> }
but here is a problem when page load ImagePath method work successfully but on the page i still get the Path like which is saved on the database \\94.19.247.273\C$\\t\q\laptop.com\bb\images\UrunImages\a1\14-09-18-_04-17-00.jpg, so i can not get changed path on the page.I want to get path like this :C:\t\q\laptop.com\bb\images\UrunImages\a1\14-09-18-_04-17-00.jpg what the problem might be?
ImagePath
C:\t\q\laptop.com\bb\images\UrunImages\a1\14-09-18-_04-17-00.jpg
i have this path /Home/ImagePath?path=%2F%2F94.19.247.273%2FC%24%2F%2FBaburtechAnakartImage%2FACER_murtaza%20test1%2F1_ACER_murtaza%20test1_12-09-18-_11-20-02.jpg.
/Home/ImagePath?path=%2F%2F94.19.247.273%2FC%24%2F%2FBaburtechAnakartImage%2FACER_murtaza%20test1%2F1_ACER_murtaza%20test1_12-09-18-_11-20-02.jpg
so i want to convert it to /Home/ImagePath?path=C%3A%2FBaburtechAnakartImage%2FACER_murtaza%20test1%2F1_ACER_murtaza%20test1_12-09-18-_11-20-02.jpg.
/Home/ImagePath?path=C%3A%2FBaburtechAnakartImage%2FACER_murtaza%20test1%2F1_ACER_murtaza%20test1_12-09-18-_11-20-02.jpg
the method convert it correctly but i can not get it on the page.