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
    Dec 22, 2011 @ 15:23
    mmmoustache
    0

    Using Image Cropper with a Multi-Node Tree Picker (Razor)

     

    I have an image gallery that's using uComponents' Multi Node Tree Picker and I want the thumbs to be crops instead of a CSS-induced version. I've used the same set-up (set the datatype up, added the cropper property to the Image media type) and syntax that I've used on other projects but the Umbraco version I'm working with is a different version (4.7.0) , so my image Url-fetching script is slightly different to usual and has created this problem.  Whenever my code is run I get the error message: 'string' does not contain a definition for 'Find'. 

    Here's my current code, with 'gallery' being the Node Picker alias, and CaseStudyThumb being the Image Cropper alias:

    @if (@Model.HasProperty("gallery") && @Model.GetProperty("gallery").Value != String.Empty)
        {
                @foreach (var x in @Model.gallery
                    {
                        var item = @Model.MediaById(@x.InnerText);
                       
    <a href="@item.umbracoFile">
    <img src="@item.Crops.Find("@name", "CaseStudyThumb").url" alt="@item.Name" />
    </a>
                    }
        }

    Thanks!

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 16:00
    Jeroen Breuer
    0

    You could also use DAMP with the Image Cropper. It has many nice features like displaying the cropped image instead of the thumbnail in the backend. Here you can find 2 demo's: http://www.screenr.com/gz0s - http://www.youtube.com/watch?v=LkcObL7CMvQ

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft