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?
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?
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
No one has experience with umbraco.library.GetMedia(3490, True) ??
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?
I'm really the only person in this forum trying to read Media types from vb.net????
I just found out alone... thanks for your precious help.
is working on a reply...