Copied to clipboard

Flag this post as spam?

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


  • Joao Pinto 24 posts 64 karma points
    Mar 22, 2012 @ 09:40
    Joao Pinto
    0

    VB.NET - Best way to read media?

    Hello,

    I have a website with some pages that must display a lot of media (a list of products), about 45 different Media items (images).

    I was using this code to read Media before:

    Dim photoGallery As New umbraco.cms.businesslogic.media.Media(CInt(escortNode.GetProperty("photoGallery").Value))

    But it is incredibly slow. It takes something like 4 seconds to read about 40-45 different Media. I've read that this is beceause that method reads data directly from the databse and it's not really optimized.

    I'm now trying to use umbraco.library.getMedia instead, which should be much better, but it's acting strange.

    If I try to read a Media directly, it works properly, with this code:

    Dim mNode As XPathNodeIterator = umbraco.library.GetMedia(3495, False)

    But I have a Media Folder with inside other Media (Slideshow of images associated to a node), if I try to read the folder, it works only the first time. I mean the first time I read the folder I get the correct data, the second time (a simple page refresh) I get an empry result...

    This code:

    Dim mNode As XPathNodeIterator = umbraco.library.GetMedia(3490, True)
    Response.Write(mNode.Current.HasChildren)

    Prints true the first time, but if I refresh the page it prints false.

    What should I do to be able to read the Media inside the specified Media Folder?

    I need a fast way to read something like 40-60 media items on vb.net, any tip?

    Thank you

     

  • Joao Pinto 24 posts 64 karma points
    Mar 23, 2012 @ 09:16
    Joao Pinto
    0

    No one has experience with umbraco.library.GetMedia(3490, True) ??

  • Joao Pinto 24 posts 64 karma points
    Mar 23, 2012 @ 16:27
    Joao Pinto
    0

    Am I maybe on the wrong forum section? I can't believe no one knows about a basic method like umbraco.library.GetMedia.... Where's the Umbraco community?

  • Joao Pinto 24 posts 64 karma points
    Mar 25, 2012 @ 19:10
    Joao Pinto
    0

    I'm really the only person in this forum trying to read Media types from vb.net????

  • Joao Pinto 24 posts 64 karma points
    Mar 26, 2012 @ 10:44
    Joao Pinto
    0

    I just found out alone... thanks for your precious help.

Please Sign in or register to post replies

Write your reply to:

Draft