AI OnAI Off
Try using the PermanentLinkMapper class and TryToMapped() method.
Frederik
Hi Frederik
Thank you for your response!!! Unfortunately the URL that comes back is tho relative mapped path, not the original Virtual Path. Any other thoughts?
Many thanks
Dave
Hi All
Has anyone got any idea on this? There has to be a way to get an alt tag for an image.
Thanks very much
Dave
Hi all
For future reference I have got it working, it was as simple as URLDecoding first, I have written an extension method which I am just calling from my DisplayTemplate and a few other places where I am outputting images, works perfectly. Code below if it helps anyone:
public static string GetDescription(this Url url)
{
var description = string.Empty;
var virtualPath = HttpUtility.UrlDecode(url.ToString());
var file = VirtualPathHandler.Instance.GetFile(virtualPath, true) as UnifiedFile;
if (file != null)
{
description = file.Summary.Dictionary["Description"] != null
? file.Summary.Dictionary["Description"].ToString()
: string.Empty;
}
return description;
}
Thanks
Dave
This somes like a really obvious thing but I cannot find any information about it anywhere. I have a property of type Url with the UiHint.Image decoration applied to it. I want to render that image on my page along with the description applied in the file manager as an alt tag. My thoughts where to modify the DisplayTemplate for the image. I have the following code to get the alt tag:
The problem I am having however is the data that I have available for me is just of type EPiServer.Url, from this I need to find out what the virtualpath for that url is.
Does anyone know how I can obtain this, or have a better suggestion on how to do it?
Many Thanks
Dave