Copied to clipboard

Flag this post as spam?

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


  • SaphuA 124 posts 87 karma points
    Sep 30, 2012 @ 16:15
    SaphuA
    0

    Media children, but only images!

    Hi there,

     

    I am able to get a Media object and want to itterate through all the children, but only the images.

    How would I do this?

    This is what I have now:

     

    Media media = new Media(folderId);
    Media[] children = media.Children.Where...?

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Sep 30, 2012 @ 18:21
    Hendy Racher
    0

    Hi SaphuA,

    How about:

      using umbraco;
      using System.Linq;
    
      Media media = new Media(123);
    
      foreach(Media imageMedia in media.GetChildMedia().Where(x => x.ContentType.Alias == "Image"))
      {
        // do something
      }
    
    
  • 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