Image Templating with .NET
Integrating an image is done by simply retrieving its URL and setting it in the template.
The following integrates a page's illustration image field.
Copy
<!-- URL of the main view -->
<img src="@Model.document.GetImage("page.illustration").Url"/>
Copy
<img src="@Model.document.GetImage("page.illustration").Url"/>
<span class="image-caption">@Model.document.GetText("page.caption").AsText()}</span>
For integrating a group of images (e.g. photo slide show in a page), you need to loop through the items:
Copy
@foreach (var imageWithCaption in Model.document.GetGroup("page.slide-show").GetDocs()) {
<img src="@imageWithCaption.GetImage("page.illustration").Url"/>
<span class="image-caption">@imageWithCaption.GetText("page.caption").AsText()</span>
}