I am attempting to make a photo gallery asp.net MVC website, and part of that involves the setting of the src to a local folder that contains images.
@model MyProj.Models.PhotoIndexViewModel
<div class="row" id="tableSearch">
@foreach (MyProj.Models.VideoModel photo in Model.PImgList)
{
<div class="col-sm-3 thumbnail">
@Html.DisplayFor(model => photo.Title)
<a href=@Url.Action("View", new { id = photo.Id })>
<img class="img-responsive"src="@Url.Content(photo.ThumbNailPrev)" alt=@photo.Id /></a>
@Html.HiddenFor(m => m.searchTerm)
@Html.Partial("_Tags", photo)
</div>
}
</div>
The ThumbNailPrev is "~/Pics/.jpg", which relates to a folder in the main part of the project. The issue is that the image does not appear. When I check the image using inspector is says it isn't found at /Pics/(photoid)/jpg. I don't understand why it is doing this, as my pics and the image itself are present at that location. I have also made sure to include the folder in my project, but it still doesn't seem to find the image.
UPDATE: I just tried something and confirmed it is something to do with the way I'm calling the path from the database. As if I hard code the EXACT same string as the one in the database it works. The question now is why does that work?