Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
hi
I am creating a photo gallery based on the damp gallery, however on my image I want to display a caption. My image file has a custom property which will contain the text for the caption however I can't seem to get it to pull through code below
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using DigibizAdvancedMediaPicker;
@using DAMP.PropertyEditorValueConverter;
@using Eksponent.CropUp;
@{
dynamic file = CurrentPage.File;
<h3 style="margin-top: 20px;">Razor DAMP file sample</h3>
<p>Download: <a href="@file.Url" target="_blank">@file.nodeName</a></p>
dynamic i = CurrentPage.galleryImages;
if (i.Count > 0)
{
var p = Helper.GetPager(9, i.Count);
<ul class="photogallery">
@foreach (dynamic d in i.Skip(p.CurrentPage * p.ItemsPerPage).Take(p.ItemsPerPage))
var caption = @Model.Content.GetPropertyValue("imageCaption");
<li>
<a class="popup" rel="gallery" href="@d.Url" title="@caption">
<img src="@CropUp.GetUrl(@d.Url, new ImageSizeArguments {CropAlias = "gallery"})" alt="@d.Alt"/>
</a>
</li>
}
</ul>
<div class="pagination">
@foreach (var number in p.Pages)
if (number - 1 != p.CurrentPage)
<a href="?page=@number">@number</a>
else
<span>@number</span>
</div>
If a add other properties e.g @d.alt in the caption field or just text it works fine but can't get the property off my image
any help gratefully appreciated
thanks
Bal
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Custom Property from Image
hi
I am creating a photo gallery based on the damp gallery, however on my image I want to display a caption. My image file has a custom property which will contain the text for the caption however I can't seem to get it to pull through code below
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using DigibizAdvancedMediaPicker;
@using DAMP.PropertyEditorValueConverter;
@using Eksponent.CropUp;
@{
dynamic file = CurrentPage.File;
<h3 style="margin-top: 20px;">Razor DAMP file sample</h3>
<p>Download: <a href="@file.Url" target="_blank">@file.nodeName</a></p>
dynamic i = CurrentPage.galleryImages;
if (i.Count > 0)
{
var p = Helper.GetPager(9, i.Count);
<ul class="photogallery">
@foreach (dynamic d in i.Skip(p.CurrentPage * p.ItemsPerPage).Take(p.ItemsPerPage))
{
var caption = @Model.Content.GetPropertyValue("imageCaption");
<li>
<a class="popup" rel="gallery" href="@d.Url" title="@caption">
<img src="@CropUp.GetUrl(@d.Url, new ImageSizeArguments {CropAlias = "gallery"})" alt="@d.Alt"/>
</a>
</li>
}
</ul>
<div class="pagination">
@foreach (var number in p.Pages)
{
if (number - 1 != p.CurrentPage)
{
<a href="?page=@number">@number</a>
}
else
{
<span>@number</span>
}
}
</div>
}
}
If a add other properties e.g @d.alt in the caption field or just text it works fine but can't get the property off my image
any help gratefully appreciated
thanks
Bal
is working on a reply...