Copied to clipboard

Flag this post as spam?

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


  • Janet Kirklen 102 posts 212 karma points
    Dec 04, 2013 @ 16:54
    Janet Kirklen
    1

    Cropper on document type returns error on newurl

    I have an Image Cropper Extended on a doc type with an property alias of Crops.  There is an associated upload property (called uploadImage) on the doctype and the image cropper is showing up and working fine.  I used the Razor snippes example from the ImageCropperExtendedDocumentation_v2.  

    @if (Model.Crops != null) {

        <img src="@Model.Crops.Find("@name","Portrait").newurl" />

    }

    This is throwing an error:

    Error Loading Razor Script (file: Get Crops) 'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'newurl'    at CallSite.Target(Closure , CallSite , Object )
      at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
      at ASP._Page_macroScripts_GetCrops_cshtml.Execute() in c:\inetpub\wwwroot\BedrockCMS\MacroScripts\GetCrops.cshtml:line 15
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

    I've also tried .url and get the same error.  Am I missing something?

  • Dirk Seefeld 126 posts 665 karma points
    Dec 04, 2013 @ 18:18
    Dirk Seefeld
    0

    I think the error is caused by @if(Model.Crops != null), because the property is not null if it is defined on the document type.
    But we need to check whether the value is not empty too. Change the if clause to: @if (Model.HasValue("Crops")) 

    Dirk

  • Dirk Seefeld 126 posts 665 karma points
    Dec 04, 2013 @ 20:40
    Dirk Seefeld
    100

    I updated the docu too.

  • Janet Kirklen 102 posts 212 karma points
    Dec 04, 2013 @ 21:10
    Janet Kirklen
    0

    That indeed was the issue.  Works like a charm now.  Thank you for the quick response.

Please Sign in or register to post replies

Write your reply to:

Draft