Copied to clipboard

Flag this post as spam?

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


  • mmmoustache 50 posts 79 karma points
    Feb 08, 2012 @ 18:42
    mmmoustache
    0

    Getting image crop from uComponents' Datatype Grid

    Hello all,

    I have a Datatype Grid property containing a media picker (among a couple of other things, to create a dynamic slideshow with a few extra bits of info for each slide) and I can't seem to get the crops of the images, usually with the error message 'Error loading MacroEngine script (file: slideshow.cshtml)'. I pretty sure the problem is to do with the media picker being embedded within another property, and that I'm not 'accessing' the media picker properly.

    Here's my code, where 'image' is the Media Picker property within the Datatype Grid (which is 'slideshow') and 'HomeSlideshow' is the crop alias:


    @inherits umbraco.MacroEngines.DynamicNodeContext
    @if (Model.HasProperty("slideshow"&Model.slideshow != null{
                                                                     
        <ul class="slideshow"
             @foreach(var item in Model.slideshow{
                
                var image Library.MediaById(item.image.InnerText)
                                                    
                <li>
                   <img src="@image.imageCropper.Find("@name", "HomeSlideshow").Url" alt="@image.Name"/>
               </li>
              
        </ul>
    }


    Kind Regards,
    mmmoustache

     

Please Sign in or register to post replies

Write your reply to:

Draft