Get Images from a particular Album using fluent API
Hi,
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()
.Images()
.Where(i => i.Status == ContentLifecycleStatus.Live && i.Width > 900)
.OrderBy(y => y.Title).Get();
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()
.Where(
(w) => w.Parent.Title == title &&
w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
.Get();
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());
results.Add(table);
return
results;
var images = App.WorkWith().Albums().Where(a => a.Title ==
"AlbumTitle"
).Get().FirstOrDefault().Images;