Copied to clipboard

Flag this post as spam?

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


  • loic ponchon 36 posts 56 karma points
    Sep 05, 2011 @ 17:05
    loic ponchon
    0

    Problem to load image with MultipleMediaPicker in current page

    Hello,

    i got a problem to load image with MultipleMediaPicker in current page.

    my umbraco config looks like :

    <DAMP fullMedia="">
                  <mediaItem>
                    <MultipleImage id="1135" version="6f8a3e4f-a557-4e6f-a7d9-216cead8e183" parentID="1122" level="3" writerID="0" nodeType="1134" template="0" sortOrder="1" createDate="2011-09-05T12:12:29" updateDate="2011-09-05T12:12:30" nodeName="Paysage" urlName="paysage" writerName="Admin" nodeTypeAlias="MultipleImage" path="-1,1121,1122,1135">
                      <image>/media/286/chrysanthemum.jpg</image>
                    </MultipleImage>
                  </mediaItem>
                  <mediaItem>
                    <MultipleImage id="1136" version="4ce88f35-e6a5-4750-b85c-da3e7d82c173" parentID="1122" level="3" writerID="0" nodeType="1134" template="0" sortOrder="2" createDate="2011-09-05T12:33:45" updateDate="2011-09-05T12:33:46" nodeName="image 2" urlName="image2" writerName="Admin" nodeTypeAlias="MultipleImage" path="-1,1121,1122,1136">
                      <image>/media/287/desert.jpg</image>
                    </MultipleImage>
                  </mediaItem>
                  <mediaItem>
                    <MultipleImage id="1137" version="14f428ea-d04e-4efe-bdb8-8f633a952db3" parentID="1122" level="3" writerID="0" nodeType="1134" template="0" sortOrder="3" createDate="2011-09-05T12:34:04" updateDate="2011-09-05T12:34:04" nodeName="image 3" urlName="image3" writerName="Admin" nodeTypeAlias="MultipleImage" path="-1,1121,1122,1137">
                      <image>/media/288/hydrangeas.jpg</image>
                    </MultipleImage>
                  </mediaItem>
              </DAMP>

    If i tried something like that :

    @foreach (var img in Model){}

    I got this error :

    Error loading Razor Script LibrariesGetPictureCarousel.cshtmlCannot 
    implicitly convert type 'umbraco.MacroEngines.DynamicNode' to 
    'System.Collections.IEnumerable'. An explicit conversion exists (are you
     missing a cast?)

    And if i try this : 

    @foreach (var img in Model.image) {}

    I can't find any parameter wich works like @img.Image or @img.Name etc ...

     

    Thank you in advance for your help

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Sep 05, 2011 @ 18:22
    Jeroen Breuer
    0

    Your DAMP xml looks a bit strange. Are you using a custom media type which only has an image property?

    What's the name of the property which has the media picker on your documenttype?

    Something like this should work:

     @foreach (dynamic d in Model.propertyName)
        {   
            <li>
                <a href="@d.MultipleImage.image">
                    <img src="d.MultipleImage.image"/>
                </a>
            </li>
        }

    Jeroen

  • loic ponchon 36 posts 56 karma points
    Sep 06, 2011 @ 10:33
    loic ponchon
    0

    Yes this is a custom media, and it's work.

    Thank you very much :)

Please Sign in or register to post replies

Write your reply to:

Draft