Image.Id or Image.FileId

Posted by Community Admin on 04-Aug-2018 12:40

Image.Id or Image.FileId

All Replies

Posted by Community Admin on 14-May-2014 00:00

can anyone tell me the difference between and image.id and image.FileId?   

I'm getting all the images from an album and building a UL with links around the images to a different page trying to pass the imageid but they all seem to be the same.  FileId seems to be unique but I can't find what the difference is. 

this is my code.

var imagelist = (from t in GetImagesByAlbumNativeAPI(album.Id)
orderby t.DateCreated descending
select t).Take(3);
htm = "<ul class=WorkAllUl>";
string currenturl = "/work/" + LOBName.Replace(" ", "-");
if (imagelist.Count() > 0)

foreach (var m in imagelist)

htm += "<li class=WorkAllLi>";
htm += "<a href=" + currenturl + "?id=" + m.Id + "&id2=" + m.FileId + ">";
htm += "<img src='" + m.Url + "' alt='" + m.AlternativeText + "' data-image-id='" + m.Id + "' data-image-Fileid='" + m.FileId + "' class=WorkAllImage></a>";
htm += "</li>";

Posted by Community Admin on 15-May-2014 00:00

Hi Theodore,

The ID you need is Image.Id. It relates to the image and represents it in the database. The FileId property is also related to the image, but is only used to generate thumbnails for the image. As far as the issue goes, I can only imagine there is something wrong with your initial query. All Image Ids are unique and represent an image. I can suggest the following lines that will return the ID of 3 published images:

LibrariesManager librariesManager = LibrariesManager.GetManager();
           var AlbumId = librariesManager.GetAlbums().Where(a => a.Title == "YourAlbum").FirstOrDefault();
           var imagelist = AlbumId.Images().Where(i => i.Status == ContentLifecycleStatus.Live).Take(3);

Regards,
Ivan D. Dimitrov
Telerik
 
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed