How to access image library

Posted by Community Admin on 04-Aug-2018 11:16

How to access image library

All Replies

Posted by Community Admin on 28-Feb-2012 00:00

Hi,

I've this sample to access NewsItem and a related Image to every NewsItem.
What I need is to just access the Image Library "Thumbnails".
As I'm a novice with LinQ I can't make it work.

this
.RadRotator1.DataSource = App.WorkWith()

                        .NewsItems()

                        .Where(n => n.Status == ContentLifecycleStatus.Live)

                        .Get()

                        .Take(this.NewsLimit)

                        .ToList()

                        .Join(App.WorkWith()

                                .Images()

                                .Get()

                                .Where(i => i.Parent.Title == "Thumbnails" && i.Status == ContentLifecycleStatus.Live),

                            item => item.Title.Value,

                            image => image.Title.Value,

                            (item, image) => new NewsItem = item, NewsImage = image );

Can somebody help me please to clean the NewsItem from but keep the typ NewsImage as it is?

Thanks

Andre

Posted by Community Admin on 29-Feb-2012 00:00

Hi Andre,

You can get a specific library by its name this way:

var album = App.WorkWith().Albums().Where(p => p.Title == "MYALBUMNAME").Get().SingleOrDefault();

where MYALBUMNAME is the name of the library.

All the best,
Victor Velev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Mar-2012 00:00

Hi Victor,

I get an error when I try to use tihs as DataSource for the RadTree:
Data source is an invalid type.  It must be either an IListSource, IEnumerable, or IDataSource.

I'm a novice with LinQ so how can I cast it to the needed datatype?

Thanks

Andre

Posted by Community Admin on 05-Mar-2012 00:00

Hello Andre,

You can create a list of images from a particular album ( or you can get the album names, depending on what you want to achieve ) and bind them in the TreeView. Please consult our API, which contains examples of how to use the images API:

www.sitefinity.com/.../querying-images

You can also check the RadTree demos on our website, in order to understand how it works:

demos.telerik.com/.../defaultcs.aspx

Regards,
Victor Velev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed