I am creating a new transformation for
Page (menu item). I am using the document's
Teaser image field so copied the
CMS.MenuItem.ImageGalleryList code to a new transformation and customized the markup. Of course I uploaded teaser images for all the pages also.
<div class="our">
<img src="<%# GetFileUrl("MenuItemTeaserImage") %>" alt="<%# Eval("DocumentName",true) %>" />
<div class="our_pop_cont">
<div class="pop_up">
<h5><%# Eval("DocumentName") %></h5>
<a href="<%# GetDocumentUrl() %>" class="pop_up_link"></a>
</div>
</div>
</div>
The markup that this produces is like:
<img alt="My Page Name" src="/getattachment/00000000-0000-0000-0000-000000000000/My-Page-Name.aspx">
...which produces a 404. I went into the database and found an actual GUID set for one of the
[CONTENT_MenuItem].[MenuItemTeaserImage] pages and manually swapped that in for the null GUID and the image loaded successfully!
/getattachment/C0E089A1-2B17-4490-B462-A41380E6ABC3/My-Page-Name.aspx
So, I started with "official" Kentico code. I uploaded the image and it made it into Kentico. The image is getting served correctly (when the correct URL is requested). However,
<%# GetFileUrl("MenuItemTeaserImage") %> does not produce the correct URL.
Am I doing something wrong? How do I get the correct URL for the MenuItemTeaserImage?