Copied to clipboard

Flag this post as spam?

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


  • Craig100 1086 posts 2374 karma points c-trib
    Apr 07, 2013 @ 21:27
    Craig100
    0

    DAMP GetImageCropperUrl Help

    In this bit of code, 

            @foreach (dynamic theImagePage in Model.Descendants("sliderBanner").Where("umbracoNaviHide == false")) { //for each banner page in the repository
                ///// NEXT LINE IS WRONG /////
                dynamic imageItem = theImagePage.bannerImmage.mediaItem.HomePageBanner.First(); 
                var theCrop = DAMP_Helper.GetImageCropperUrl(imageItem, "sliderImage");
    //do some stuff
    }

    Can anyone clear up what the 1st argument in GetImageCropperUrl(DynamicXml mediaItem, string cropName) should be from this XML as I'm totally confused:-

          <sliderBanner id="1116" parentID="1115" level="3" creatorID="0" sortOrder="0" createDate="2013-04-06T22:28:56" updateDate="2013-04-07T18:43:44" nodeName="Banner 1" urlName="banner-1" path="-1,1065,1115,1116" isDoc="" nodeType="1112" creatorName="admin" writerName="admin" writerID="0" template="0">
            <umbracoNaviHide>0</umbracoNaviHide>
            <bannerImage>
              <DAMP fullMedia="">
                <mediaItem>
                  <HomePageBanner id="1119" version="e68932f4-d24c-484b-9ced-d662dac6e429" parentID="1118" level="2" writerID="0" nodeType="1104" template="0" sortOrder="0" createDate="2013-04-06T22:41:19" updateDate="2013-04-07T11:39:10" nodeName="banner-fruit" urlName="banner-fruit" writerName="admin" nodeTypeAlias="HomePageBanner" path="-1,1118,1119">
                    <sliderImage>
                      <crops date="2013-04-06T22:41:19">
                        <crop name="sliderImage" x="0" y="0" x2="960" y2="377" url="/media/1016/banner-fruit_sliderImage.jpg" />
                      </crops>
                    </sliderImage>
                    <umbracoFile>/media/1016/banner-fruit.jpg</umbracoFile>
                    <umbracoWidth>960</umbracoWidth>
                    <umbracoHeight>378</umbracoHeight>
                    <umbracoBytes>172343</umbracoBytes>
                    <umbracoExtension>jpg</umbracoExtension>
                  </HomePageBanner>
                </mediaItem>
              </DAMP>
            </bannerImage>
            <caption><![CDATA[5 a day keeps the doctor away!]]></caption>
            <linkAddress>http://www.nhsdirect.nhs.uk</linkAddress>;
          </sliderBanner>
    
    I just want the url for the crop but can't make it work.

    Have had so much trouble with Custom DAMP saving only ID, thought saving as XML might be clearer, but hey ho!
    Cheers,
    Craig
  • Craig100 1086 posts 2374 karma points c-trib
    Apr 07, 2013 @ 21:33
    Craig100
    0

    Couldn't safely edit above...

    Am using the DAMP Razor model, (non-MVC version) with just the following in the head of the file:-

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @using DigibizAdvancedMediaPicker;
  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Apr 16, 2013 @ 12:36
    Jeroen Breuer
    0

    If you're using the DAMP Razor model you shouldn't use GetImageCropperUrl (which is an old helper). You should do this:

    dynamic imageItem = theImagePage.bannerImage.First; 
    var theCropUrl = imageItem.Crops.sliderimage;
    <img src="@theCropUrl
    " alt="@imageItem.Alt"/>

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft