Copied to clipboard

Flag this post as spam?

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


  • Streety 358 posts 568 karma points
    Feb 24, 2014 @ 16:09
    Streety
    0

    Ublogsy with DAMP and Crops

    Hi,

    I am struggling with trying to get the DAMP controls to work with crops.

    Have got the image inserted into the showpostcshtml:

     @{  
    dynamic media = Model.MediaById(Model.uBlogsyContentImage);
    <img src="@media.umbracoFile" alt="@media.nodeName" class="blogImage" />
    }

    But getting crops in there is defeating me.

    I am using the razor examples and have got it all going just fine when I am calling from @model

    @{
    if (Model.HasValue("uBlogsyContentImage"))
    {
    dynamic mediaItems = Model.uBlogsyContentImage.mediaItem;
    if (mediaItems.Count() != 0)
    {
    <ul>
    @foreach (var item in mediaItems)
    {
    var image = item.Image;
    <li>
    @{ var crops = image.mediaCropper; }
    @if (crops.GetType().ToString() != "System.String")
    {
    <img src="@crops.Find("@name", "Blog").url" alt="@image.nodeName"/>
    }
    </li>
    }
    </ul>
    }
    }
    }

    I am struggling to fit in this code as I don't have @Model but a referenced value which doesn't return any values when I try and get the mediaItems.

     

    var file = d.GetProperty("uBlogsyContentImage").mediaItems

     

    I am sure I am getting mixed up between typed and dynamic syntax.

     

    Basically I have a DAMP control

    uBlogsyContentImage

    That I want the crop "Blog" from 

     

    Any help would be much appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft