Copied to clipboard

Flag this post as spam?

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


  • David Zweben 231 posts 688 karma points
    Aug 17, 2012 @ 21:51
    David Zweben
    0

    Displaying imageCrop image in Locator results

    I have the Razor Locator set up to search locations with the Document Type "Location". On each Location page, I have an uploader and image cropper, so the XML looks something like this:

    <Location id="1318" parentID="1333"  nodeName="Houston, TX" urlName="houston-tx" ... > <umbracoFile>/media/5170/img-20110802-00130.jpg</umbracoFile>
    <coordinates><![CDATA[29.6738875,-95.08878349999998,13]]></coordinates>
    <imageCrop>
    <crops date="10/05/2012 11:50:53">
    <crop name="Location Photo" x="394" y="43" x2="1767" y2="1416" url="/media/5170/img-20110802-00130_Location Photo.jpg" />
    </crops>
    </imageCrop>
    <locationName>Lorem ipsum</locationName>
    <state><![CDATA[CA]]></state>
    <streetAddress>Lorem ipsum dolor sit amet</streetAddress>
    <city>La Porte</city>
    <zipCode>77571</zipCode>
    </Location>

    I am trying to add the cropped image for each result next to the other info in the search results list. Earlier, I was able to add extra textstring fields to the results before by using @node.state, @node.city, etc. I was also able to display an image crop image from a specific node ID like so:

    <img src='@Model.NodeById(1284).imageCrop.Find("@name", "Location Photo").url' />

    ...which of course displays the same image for each result. I figured I could just use @node as a starting point like I did with the textstrings:

    <img src='@node.imageCrop.Find("@name", "Location Photo").url' />

    ...but when I do that, I get the following error:

    Error Loading Razor Script (file: Locator) 'string' does not contain a definition for 'Find'    at CallSite.Target(Closure , CallSite , Object , String , String )...

    ...and so on. How can I output the imageCrop URL for each search result in the search results @foreach loop?

    Any help would be appreciated.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies