More in this section

Forums / General Discussions / Get Images from a particular Album using fluent API

Get Images from a particular Album using fluent API

2 posts, 0 answered
  1. UI Crew
    UI Crew avatar
    151 posts
    27 Sep 2012
    09 Dec 2010
    Link to this post

    I have developed a control for a custom image gallery which outputs a unordered list of images however I can't seem to work out a method of pulling the images out of a particular album "just" by Album Name using the Fluent API (or the standard API for that matter)

    I am using this code below but can't find how I can modify it to utilise AlbumName with out running into permission issues when the control is in the public frontend:

    public IQueryable<Telerik.Sitefinity.Libraries.Model.Image> FindGalleryImages(string AlbumName)
                return App.WorkWith()
                            .Where(i => i.Status == ContentLifecycleStatus.Live && i.Width > 900)
                            .OrderBy(y => y.Title).Get();

    This is a public control so any code I use must not need a user with admin permissions (I tried a couple of methods in the API but whenever I tried to view the page with an anonymous user the images would then not show.

    The site is now live but the image gallery on the product pages are exactly the same because the API will not allow my image list to be filtered by a particular Album. You can view the image gallery in production (without filtering):


  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    11 Dec 2010
    Link to this post
    Hello Webinsite,

    Thank you for using our services.

    Can you try using the same code as in the SDK sample Coverflow and Book widgets? Bellow is the code snippet used by those controls:
    private List<Hashtable> GetImages()
        List<Hashtable> results = new List<Hashtable>();
        string title = this.AlbumTitle;
        ////get IQueryable of images from the Fluent API.
        var images = App.WorkWith().Images()
            (w) => w.Parent.Title == title &&
                   w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
        var authority = this.GetAuthorityUrl();
        foreach (Telerik.Sitefinity.Libraries.Model.Image v in images)
            Hashtable table = new Hashtable();
            table.Add("Url", authority + v.MediaUrl);
            table.Add("Title", v.Title.ToString());
        return results;

    You can also try this piece of code:
    var images = App.WorkWith().Albums().Where(a => a.Title == "AlbumTitle").Get().FirstOrDefault().Images;

    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered