Hello,
do you mean that you created the attribute of Text type and field of Media Selection type in your custom document type?
In this case relative path to image (unfortunately with site code name) is created and stored in database.
So you will need to remove it in your transformation. Please take a look at following workaround transformation code. You can choose if you want to create absolute or relative URL without alias.
<%@ Register TagPrefix="cc2" Namespace="CMS.CMSHelper" Assembly="CMS.CMSHelper" %>
<%@ Register TagPrefix="cc3" Namespace="CMS.GlobalHelper" Assembly="CMS.GlobalHelper" %>
<script runat="server">
// creates a relative URL path without site code name
protected string getRelURL()
{
// gets value from database
string withAlias = (string)CMSContext.CurrentDocument.GetValue("MediaSelection");
// removes "/TestCmsSite" and adds ~
string withoutAlias = "~" + withAlias.Substring(12);
return withoutAlias;
}
// creates an absolute URL path without site code name
protected string getAbsoluteURL()
{
string withAlias = (string)CMSContext.CurrentDocument.GetValue("MediaSelection");
string withoutAlias = withAlias.Substring(12);
return "http://"+UrlHelper.GetFullDomain()+withoutAlias;
}
</script>
<p>
<img src="<%=getRelURL() %>" />
</p>
<%=getAbsoluteURL() %>
I hope this code helps you.
I also created a requirement to remove site code name from image path in one of next version.
Best regards,
Ivana Tomanickova