Copied to clipboard

Flag this post as spam?

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


  • Toni Becker 146 posts 425 karma points
    Mar 26, 2011 @ 12:03
    Toni Becker
    0

    Razorsnippet for retrieving Multiimages with Damp

    @foreach (var item in Model.multiImage)
    {
    <img src="@item.mediaItem.Image.umbracoFile"/>
     }

     

    This is my query so far. Nothings coming back. Some Ideas ? Thanks for help so far.

     

    Ah okaay this is my XML output:

    <multiImage>
            <DAMP fullMedia="">
              <mediaItem>
                <Image id="1305" version="eb6e6737-a250-45e6-b09b-f3fd916d69a0" parentID="1251" level="3" writerID="0" nodeType="1032" template="0" sortOrder="7" createDate="2011-03-26T11:08:30" updateDate="2011-03-26T11:08:30" nodeName="abby_flexi_capture" urlName="abby_flexi_capture" writerName="admin" nodeTypeAlias="Image" path="-1,1249,1251,1305">
                  <umbracoFile>/media/1800/abby_flexi_capture.jpg</umbracoFile>
                  <umbracoWidth>585</umbracoWidth>
                  <umbracoHeight>185</umbracoHeight>
                  <umbracoBytes>25538</umbracoBytes>
                  <umbracoExtension>jpg</umbracoExtension>
                </Image>
              </mediaItem>
              <mediaItem>
                <Image id="1306" version="64c52dfe-4601-452c-ac44-6643a461e933" parentID="1251" level="3" writerID="0" nodeType="1032" template="0" sortOrder="8" createDate="2011-03-26T11:13:13" updateDate="2011-03-26T11:13:14" nodeName="beratung" urlName="beratung" writerName="admin" nodeTypeAlias="Image" path="-1,1249,1251,1306">
                  <umbracoFile>/media/1807/beratung.jpg</umbracoFile>
                  <umbracoWidth>585</umbracoWidth>
                  <umbracoHeight>185</umbracoHeight>
                  <umbracoBytes>23498</umbracoBytes>
                  <umbracoExtension>jpg</umbracoExtension>
                </Image>
              </mediaItem>
            </DAMP>
          </multiImage>

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 26, 2011 @ 12:11
  • Toni Becker 146 posts 425 karma points
    Mar 26, 2011 @ 12:36
    Toni Becker
    0

    Hehe i've read this thread, but the problem is when i add more than 1 picture via DAMP i can't retrieve the data.

     

    Everything works fine with just 1 Picture (DAMP multiple=no result).

    Like said before data with @Model.multiImage.mediaItem.Image.umbracoFile for 1 Picture works.

    Looping through gives error back.

    @foreach (var item in Model.multiImage.mediaItem.Image.umbracoFile)  <- must give back a loop through all umbracoFiles and store it in item
    {
    <img src="@item"/>
     }

     

    Please check this out :) thanks alot

     

  • Toni Becker 146 posts 425 karma points
    Mar 29, 2011 @ 08:01
    Toni Becker
    1

    Solved and here's the new razor code:

    @{  
      dynamic node = new umbraco.MacroEngines.DynamicNode(1049);
      }
     
    @foreach (var item in node.Children)
        {
         int count = 0;
         foreach (var image in item.imageUpload)
         { count = count + 1; }
         for (var i = 0; i < count; i++)
           {
            if (count == 1)
            {
           <img src="@item.imageUpload.mediaItem.Image.umbracoFile" />
             }
            else
            {
             <img src="@item.imageUpload.mediaItem[i].Image.umbracoFile" />
             }
           }    
         }
Please Sign in or register to post replies

Write your reply to:

Draft