In my Razor code, I am using a foreach loop to display images from the Multiple Media Picker in Umbraco. The Response.Write is just there for debugging purposes and the images are displaying correctly. My actual question pertains to populating the image tag with the image URL using a JavaScript function, which is not currently working.
Below is the snippet of code from the Razor view/CSHTML:
var imagesList = portfolioItem.GetPropertyValue<string>("Images").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var imagesCollection = Umbraco.TypedMedia(imagesList);
foreach (var imageItem in imagesCollection)
{
Response.Write("<img src='"+ @imageItem.Url +"' />");
}
And here is the relevant part of the JavaScript code:
openInfoWindow = function (name, imagesCollection, location, mw, url, marker) {
var infoText = "<img src='" + imagesCollection + "' alt='" + imagesCollection + "'title='" + imagesCollection + "' />";
}