Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Knowing the album name, how i get the url to the album?
leocharrua
#1 Posted : Thursday, 12 August 2010 1:21:41 PM(UTC)
Rank: Newbie

Joined: 3/08/2010(UTC)
Posts: 3
Location: Uruguay

Knowing the album name, how i get the url to the album?
Thanks
Roger Martin
#2 Posted : Thursday, 12 August 2010 1:27:57 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,168
Location: Fort Atkinson, WI

Album names can be repeated in a gallery, so there is no reliable way to do it.

That said, you could write code to iterate through each album and checking its title. When you find a match, generate an URL based on its ID. For example, an URL to album #27 will have "aid=27" appended to the query string.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
leocharrua
#3 Posted : Friday, 13 August 2010 12:12:54 PM(UTC)
Rank: Newbie

Joined: 3/08/2010(UTC)
Posts: 3
Location: Uruguay

For example, knowing the path to the album: Pictures -> Houses -> HouseId, how i get the album id by code?
Thanks
Roger Martin
#4 Posted : Saturday, 14 August 2010 11:21:11 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,168
Location: Fort Atkinson, WI

You could do something like this:

Code:
private int FindAlbumByPath(string albumPathToFind)
{
    //string albumPathToFind = @"C:\Inetpub\wwwroot\galleryserverpro\mediaobjects\Summer 2005\sunsets\desert sunsets";

    IAlbum rootAlbum = Factory.LoadRootAlbumInstance();

    return FindAlbumByPath(albumPathToFind, rootAlbum);
}

private static int FindAlbumByPath(string albumPathToFind, IAlbum albumToSearch)
{
    if (albumToSearch.FullPhysicalPath.Equals(albumPathToFind, StringComparison.OrdinalIgnoreCase))
    {
        return albumToSearch.Id;
    }
    else
    {
        foreach (IGalleryObject childAlbum in albumToSearch.GetChildGalleryObjects(GalleryObjectType.Album))
        {
            return FindAlbumByPath(albumPathToFind, (IAlbum)childAlbum);
        }
    }

    return int.MinValue;
}

Roger Martin
Creator and Lead Developer of Gallery Server Pro
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.