Copied to clipboard

Flag this post as spam?

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


  • Webgears 1 post 21 karma points
    Apr 29, 2014 @ 21:46
    Webgears
    0

    Problem with 7.1.1 Image Cropper

    Am i misunderstanding how this works.
    The line in Bold does not work, all the others work fine.

    <img src='@Model.Content.GetCropUrl(propertyAlias: "image", width:100, height:100 )'/>
    @foreach(var item in @Umbraco.Content(1143).Children().Where("Visible"))
    {
    <img src='@item.image.src' />
    <img src='@item.Content.GetCropUrl(propertyAlias: "image", width:100, height:100 )'/>
    }

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Apr 29, 2014 @ 21:51
    Jeavon Leopold
    0

    Hi Brian,

    Just a mixture of typed and dynamic models, for this option you need to use typed.

    Try this:

    @foreach(var item in Umbraco.TypedContent(1143).Children().Where(x => x.IsVisible()))
    {
        <img src='@item.GetCropUrl(propertyAlias: "image", width:100, height:100 )'/>
    }  
    

    Jeavon

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Apr 29, 2014 @ 21:58
    Jeavon Leopold
    0

    To use the dynamic model you can do this

    @foreach(var item in Umbraco.Content(1143).Children().Where("Visible"))
    {
        var myImageUrl = ImageCropperTemplateExtensions.GetCropUrl(item, propertyAlias: "image", width:100, height:100);
        <img src='@myImageUrl'/>
    }  
    
Please Sign in or register to post replies

Write your reply to:

Draft