I need to write a custom widget (or whatever you want to call it) that shows the latest two uploaded images from user specific galleries. The problem is that I don't even know when do get started.
I'm assuming there is a way to get a specific gallery as a collection, order and then grab the first two?
Any help would be greatly appricated!
Thanx,
Peter
I'm also trying to do something very similar. I was trying to fetch the images attached to a media gallery so I can iterate over them and make my own custom Lightbox gallery. I'm not exactly sure how to start or where the media info in stored in the DB. Are the media items in the "posts" table?
Any ideas are much appreciated.
So I was able to figure this out for my specific case using the REST API. I pretty much get a collection for a specifc media gallery, I check if the items are published, I sort it by date, and then I just do getRange()
Something like:
using CommunityServer.WebServices.MediaGalleries;
MediaGalleriesService service = new MediaGalleriesService(ConfigurationManager.AppSettings["SiteURL"].ToString(), ConfigurationManager.AppSettings["SiteUser"].ToString(), ConfigurationManager.AppSettings["APIKey"].ToString());
MediaGallery media = service.GetMediaGallery(ConfigurationManager.AppSettings["MediaGalleryName"].ToString());
List<MediaGalleryPost> items = service.GetMediaGalleryPosts(media.Id);
items.Sort(*** Custom Compare Class ***);
items = items.FindAll(*** Custom IsPublished Method ***);
items = items.GetRange(0, 2);
And from here I have a cleaned collection that I can bind or loop through…
Hope this helps!
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com