Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Balram Narad 37 posts 89 karma points
    May 28, 2014 @ 13:11
    Balram Narad
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft