how can one get a photo out a photocollection?

Topics: Developer Forum, User Forum
Nov 15, 2007 at 2:47 PM
Hello out there

i've been playing around with the flickr API and the flickr.NET component.
what i'm trying to achieve is to get on a .net website, thumbs of the 3 most recently added photo's of my flickr-account
i've established that quite easily, thanks to the flickr.net api, but i'm struglin a bit for the next step in my wishlist :)

i'm trying to put up a few thumbs of my flickr-account, and they should be rotating (eg when the page is refreshed).
my question really is how i can get one random image out of a PhotoSet?

i'll post below the code i'm using to get the full photoset :

protected void Page_Load(object sender, EventArgs e)
{
TestRepeater.DataSource = SetPhotos(0);
TestRepeater.DataBind();
}

public static FlickrNet.PhotoCollection SetPhotos(int setNr)
{
FlickrNet.Flickr flickr = new FlickrNet.Flickr();

FlickrNet.Photosets sets = flickr.PhotosetsGetList(ConfigurationManager.AppSettings.Get("UserId"));
FlickrNet.Photoset set = sets.PhotosetCollectionsetNr;

return flickr.PhotosetsGetPhotos(set.PhotosetId);
}

so what this does, is get the PhotoSets from a FlickrAccount , filtered via userID,
then i filter one photoset out by using an index when i add the content to my repeater.

now what i'ld like to get is something like thise :

flickr.PhotoSet.GetPhoto(random number between 0 and photoset.NumberOfPhotos)

so i can put up one random thumb of the photoset on my page.

honorable greetings,
and thanks in advance

Dries Delaey