Kunal Chawla
Kunal Chawla

Reputation: 55

Image Carousel with images from Media Library Kentico 11

I want to create a bootstrap image carousel in Kentico 11 while fetching the images from the media library. Is there any step by step guide creating that in a page?

Upvotes: 0

Views: 438

Answers (3)

Andriy B.
Andriy B.

Reputation: 451

I suggest using the Media Gallery Web Part (if you are using Portal Engine). You need to set:

  • Media Library from the list of existing media libraries
  • Adjust content transformation according to your needs

UPD: Transformation Example see below:

<a rel="lyteshow[4]" 
  href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileUrl(Eval("FileLibraryID") ,Eval("FilePath"), Eval("FileGUID"), Eval("FileName"), GetDataControlValue<bool>("UseSecureLinks"), false)) %>?ext=<%# Eval("FileExtension", true) %>" 
  title="<%# ResHelper.GetString(Convert.ToString(Eval("FileDescription", true))) %>"><img 
    src="<%# MediaLibraryFunctions.GetMediaFileUrl(Eval("FileGUID"), Eval("FileName")) %>" 
    alt="<%# ResHelper.GetString(Convert.ToString(Eval("FileDescription", true))) %>" 
    title="<%# ResHelper.GetString(Convert.ToString(Eval("FileTitle", true))) %>" 
    width="140" border="0" /></a>

Upvotes: 0

Mani bhushan Sharma
Mani bhushan Sharma

Reputation: 59

I would follow the below steps :-

  • Create a custom page type(content only) to have Image URL(media
    selector), AltText, Redirection URL attribute.
  • Create a folder for carousel.
  • Create pages under the folder for each carousel image and upload images via media selector & update other attributes.
  • Add the repeater transformation on the page for carousel referencing all the pages under the carousel folder.

Upvotes: 1

DTK
DTK

Reputation: 470

if you're using portal engine have a look at the documentation for creating a new Web Part. The dynamic component, which in your case would be an image carousel)

https://docs.kentico.com/k11/custom-development/developing-web-parts/creating-new-web-parts

Or have a look at default Image gallery Web Part, which renders a number of images.


Depending on the implementation, but regarding to getting items from the Media library directly using API, try the API examples on:

https://docs.kentico.com/api11/content-management/media-libraries

Where you end up with something like:

MediaFileInfo myFile = MediaFileInfoProvider.GetMediaFileInfo(library.LibraryID, "NewFolder/Image.png");

Upvotes: 0

Related Questions