Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 4.x > Installation and deployment > Media Library and Lightbox Gallery View modes: 
User avatar
Member
Member
sean.kinley-techfringe - 3/13/2009 9:00:45 AM
   
Media Library and Lightbox Gallery
In version 4.0, is it possible to configure a Lightbox Gallery webpart to read from a Media Library folder? If so, how? If not, this would be a great feature to add to the next version.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/18/2009 8:17:27 AM
   
RE:Media Library and Lightbox Gallery
Hi Sean,

Please see 'Use Lightbox for displaying images' section at http://devnet.kentico.com/docs/4_0/devguide/using_custom_media_player.htm for more details.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
sean.kinley-techfringe - 4/25/2009 7:20:45 PM
   
RE:Media Library and Lightbox Gallery
I've tried this while following the instructions in the help doc, but I'm not having much luck. It appears that "if (this.DisplayActiveContent)" at about line 152 of ~\CMSModules\MediaLibrary\Controls\LiveControls\MediaFilePreview.ascx.cs is equating to false.

(As per the manual, I added a media gallery web part to a page, and added references to the .js files required for the lightbox.) I've made the modifications as per page 702 of the dev guide, but, after debugging, it seems as if the program isn't even passing through that changed line of code anyway. So, any further input is appreciated.


User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 5/19/2009 12:05:20 PM
   
RE:Media Library and Lightbox Gallery
Hello,

Unfortunatelly it is a bug in current version. We're sorry for the inconvenience.

However, there is quite simple workaround.
The problem is really in the mentioned part of the condtion in MediaFilePreview.ascx.cs, line #153.
You will need to change it from File.Exists(mfi.FilePath) to File.Exists(MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath))
Please see the resulting code below (rendering code under "//lightbox mod" comment):
...
if (this.DisplayActiveContent)
{
if (ImageHelper.IsImage(mfi.FileExtension) && File.Exists(MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath)))
{
// Images are always processed by secure page
if (!this.UseSecureLinks)
{
if (completeUrl)
{
url = MediaFileInfoProvider.GetMediaFileAbsoluteUrl(si.SiteName, mfi.FileGUID, mfi.FileName);
}
else
{
url = MediaFileInfoProvider.GetMediaFileUrl(mfi.FileGUID, mfi.FileName);
}
}

//lightbox mod
int[] dim = ImageHelper.EnsureImageDimensions(Width, Height, MaxSideSize, mfi.FileImageWidth, mfi.FileImageHeight);
Width = dim[0];
Height = dim[1];
this.ltlOutput.Text = "<a href=\"" + url + "\" rel=\"lightbox[gallery]\" title=\"" + mfi.FileTitle + "\"><img src=\"" + url + "\" border=\"0\" width=\""+Width+"\" height=\""+Height+"\" /></a>";
}
else ...

...

There are some differences from the tutorial in devguide, the 3 lines of code under "lightbox mod" serve just to ensure that image dimension variables are properly set (and they're used in modified output text).

Notes:
1) Ensure you have enabled the "Display active content" property for the Image Gallery webpart.
2) You could use webpart General/ HeadHTML webpart to link lightbox scripts, and it's recommended to use separate scripts, not these from Lightbox webpart's files folder.

Hope this helps.

Regards,
Zdenek C.

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 8/14/2011 10:47:31 PM
   
RE:Media Library and Lightbox Gallery
Hello kentico_zdenekc, (Hope i'll be forgiven for digging up this old thread)

I followed your steps.. everything works fine except just that images wont load up on lightbox.. i mean on clicking an image, lightbox turns up with a loading icon and stays like that forever.

Any idea what i might be missing?

Cheers
Varinder



User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 8/16/2011 5:45:46 AM
   
RE:Media Library and Lightbox Gallery
Anyone?

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 8/17/2011 1:58:44 AM
   
RE:Media Library and Lightbox Gallery
Hi,

We will probably need more details of your setup. Besides the Kentico CMS version you are using, we'd like to see some results from debugging (using e.g. FireBug or any other web development browser tool, optionally Fiddler) - if the image actually exists or if there's a wrong path or something.
Would it be possible to see the behavior online somewhere?
Optionally please contact us at our support email address with access to your site so we could check it.

Thank you in advance for info.

Regards,
Zdenek C.