In Umbraco (4.7.0), I'm using a small Razor script to render images from an image property but even though this method is receiving the correct information, the images won't display; a tilde is always generated in front of the URL but this is actually stopping the image from displaying. Is there a way (or perhaps an alternative method of rendering media altogether) to remove the tilde?
This is essentially what's in the razor script, with primaryImage being the image property:
<img class="primary-image" src="@Model.MediaById(Model.primaryImage).umbracoFile" alt="@Model.MediaById(Model.primaryImage).Name">
This snippet actually sits within a foreach loop, to render an image if the property has one.
@Url.Content()
possibly so it resolves to a site-relative URL? e.g.src="@Url.Content(Model.MediaById(Model.primaryImage).ubracoFile)"
(As long as that's what's generating the~/Path/to/File.jpg
value.) – Brad Christieweb.config
<pages><namespaces>
as an entry, you may need to add@using System.Web.Mvc
to the top of your page to see that method. – Brad Christie