public static string NSpotXMLGallery(int NSpotID) { List <PhotoCollection> collections = new List <PhotoCollection>(); List <Photo> DynamicPhotos = Photo.GetNSpotPhotosByNSpotID(NSpotID); PhotoCollection NewCollection = new PhotoCollection(); int MemberID = -1; int MemberPhotoCount = 0; for (int i = 0; i < DynamicPhotos.Count; i++) { if (DynamicPhotos[i].MemberID != MemberID) { NewCollection = new PhotoCollection(); NewCollection.Name = DynamicPhotos[i].Member.NickName; MemberID = DynamicPhotos[i].MemberID; MemberPhotoCount = 0; } MemberPhotoCount++; NewCollection.Photo.Add(DynamicPhotos[i]); // if the next photo is a differnt member of this is the last loop then add if (i == (DynamicPhotos.Count - 1)) { NewCollection.Description = "Photos " + MemberPhotoCount.ToString(); collections.Add(NewCollection); } else if (DynamicPhotos[i + 1].MemberID != MemberID) { NewCollection.Description = "Photos " + MemberPhotoCount.ToString(); collections.Add(NewCollection); } } StringBuilder sb = new StringBuilder(); sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>"); sb.Append(@"<gallery>"); for (int i = 0; i < collections.Count; i++) { List <Photo> photos = collections[i].Photo; if (photos.Count > 0) { string NickName = photos[0].Member.NickName; string ThumbPath = "user/" + NickName + "/" + "pthmb/"; string LargePath = "user/" + NickName + "/" + "plrge/"; object[] AlbumParameters = new object[6]; AlbumParameters[0] = collections[i].WebPhotoCollectionID; AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL; AlbumParameters[2] = LargePath; AlbumParameters[3] = ThumbPath; AlbumParameters[4] = collections[i].Name; AlbumParameters[5] = collections[i].Description; //AlbumParameters[6] = collections[i].Description; //gallery title sb.AppendFormat(@" <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters); for (int j = 0; j < photos.Count; j++) { object[] PhotoParameters = new object[2]; PhotoParameters[0] = photos[j].PhotoResourceFile.FileName; PhotoParameters[1] = string.Empty; sb.AppendFormat(@" <img src=""{0}"" caption=""{1}"" />", PhotoParameters); } sb.Append(@" </album>"); } } sb.Append(@"</gallery>"); return(sb.ToString()); }