Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Media Gallery not showing Images View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
gitesh-kudosweb - 11/2/2010 5:46:31 PM
   
Media Gallery not showing Images
Hi guys,

I am making a media gallery but images are not showing up. It does show the site tree but doesn't show content in it.

I am using media gallery webpart and the webpart properties are as below:
Media library*: Test(Dropdown selected)
Path: Empty (Is this Compulsory?)
Show subfolders content: Enabled
Use secure links: Enabled
Transformation Name: Community.Transformations.MediaLibrary

I am using the same transformation code as it is being used in Corporate Site.

The page is not on the Sitemap as it is still for testing purpose, but you can look at the page on below URL:
http://www.waterfrontauckland.co.nz/Media-Test.aspx

Your help is much appreciated.

Thanks
Gitesh

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/3/2010 3:15:26 PM
   
RE:Media Gallery not showing Images
Hi,

Could you please send me the export of your site with reference on this thread (support@kentico.com)? Alternatively, could you please grant me with an access to your site?

Could you please also answer following questions?:

Have you upgraded your system?
Could you please run a permission test in Site Manager - Administration - System - Files - Test files and tell us its result?
Have you renamed any directories in the project folder?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Jason - 3/31/2011 5:38:22 AM
   
RE:Media Gallery not showing Images
I am also having this issue.
I added the webpart as per the guide but no images show.

The file tests passed all OK

Any Ideas please?

Thanks

Jason

User avatar
Member
Member
Jason - 3/31/2011 6:03:06 AM
   
RE:Media Gallery not showing Images
I am using the latest version I think?
I think some of the default transforms for the image gallery are broken too.

I still cant get the media library to work, so Itried an image gallery and I get this error:

[CMSDataProperties.LoadTransformation]: http://server/MosaicKentico/CMSTransformations/435533d4-f020-41c6-99c8-46269eb40dac/cms/file/imagegallery_thumbnails300.ascx(5): error BC32017: Comma, ')', or a valid expression continuation expected.

I tried fixing it but no go

Jason

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 3/31/2011 7:56:36 AM
   
RE:Media Gallery not showing Images
Hi,

could you please compare the transformation code with following?


<a href="?imagepath=<%# System.Web.HttpUtility.UrlEncode(DataBinder.Eval(Container, "DataItem.NodeAliasPath").ToString()) %>">
<%# IfEmpty(Eval("FileAttachment"), "no image", "<img alt=\"" + Eval("FileName") + "\" src=\"" + GetFileUrl("FileAttachment") + "?maxsidesize=300\" border=\"0\" />") %>
</a>


Selected transformation property of webpart should be set to: CMS.File.ImageGallery_thumbnails300

Could you please confirm that you use Image gallery webpart?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Jason - 3/31/2011 9:20:42 AM
   
RE:Media Gallery not showing Images
Hi
I am using the Image gallery webpart.
I put your transofrmation in and in VS2010 it highlights it as an error.

User image

And i get teh same Error

Thanks

Jason

User avatar
Member
Member
Jason - 3/31/2011 5:20:01 PM
   
RE:Media Gallery not showing Images
Is this a bug, or am I doing something wrong?
I have followed the Dev guide but I cant see any images when I use the Media gallery. It shows the Folder name, and Shows the pager but no images.

The Image Gallery still gives an error, even with the above posted Transform.
I can make my own Media Gallery if this is a bug or some problem.

Kentico is just so flexible, but I would like to know if I am doing something wrong ?

Thanks

Jason

User avatar
Member
Member
Jason - 4/1/2011 3:15:58 AM
   
RE:Media Gallery not showing Images
OK guys the default Transforms are definitely broken for the media gallery and image library.
I just looked at the transform for the Media Gallery

<%@ Control Language="VB" AutoEventWireup="true" Inherits="CMS.Controls.CMSAbstractTransformation" %>
<%@ Register TagPrefix="cc1" Namespace="CMS.Controls" Assembly="CMS.Controls" %>
<%@ Register Src="~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx" TagName="MediaFilePreview" TagPrefix="cc1" %>
<div class="mediaItem">
<table>
<tr>
<td class="mediaLibraryPhoto"><a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<cc1:MediaFilePreview ID="filePreview" runat="server" maxsidesize="117" width="117" height="117" /></a>
</td>
</tr>
<tr>
<td class="mediaLibraryDescription">
<a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<%# HTMLEncode(LimitLength(GetNotEmpty("FileTitle;FileName"), 20, "...")) %>
</a><br/>
Size: <%# DataHelper.GetSizeString(ValidationHelper.GetLong(Eval("FileSize"), 0)) %><br/>
Uploaded: 

<%--
This Causes an ERROR
<%# ((DateTime)Eval("FileCreatedWhen")).ToString("M/d/yyyy") %>
--%>

</td>
</tr>
</table>
<div class="mediaItemBottom"></div>
</div>


Above is the default Transform. I commented out the Date Time part and now the control works.
I am not complaining at all, I just would like to know if this is normal or have I maybe messed up my install.

Many Thanks

Jason

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 4/1/2011 2:58:22 PM
   
RE:Media Gallery not showing Images
Hi,

the code of transformation seems to be modified. Could you please replace it with following one? It should help.


<%@ Register Src="~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx" TagName="MediaFilePreview" TagPrefix="cc1" %>
<div class="mediaItem">
<table>
<tr>
<td class="mediaLibraryPhoto"><a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<cc1:MediaFilePreview ID="filePreview" runat="server" maxsidesize="117" width="117" height="117" /></a>
</td>
</tr>
<tr>
<td class="mediaLibraryDescription">
<a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<%# HTMLEncode(LimitLength(GetNotEmpty("FileTitle;FileName"), 20, "...")) %>
</a><br/>
Size: <%# DataHelper.GetSizeString(ValidationHelper.GetLong(Eval("FileSize"), 0)) %><br/>
Uploaded: <%# ((DateTime)Eval("FileCreatedWhen")).ToString("M/d/yyyy") %>

</td>
</tr>
</table>
<div class="mediaItemBottom"></div>
</div>


Best regards,
Ivana Tomanickova

User avatar
Member
Member
info-business-it - 6/5/2011 9:57:40 AM
   
RE:Media Gallery not showing Images
Hi,

I have the same problem, I changed the transformation code on "Community.Transformations.MediaLibrary" with the code above but i have a broken link on the request ulr from the image
www.magendanet.gr/Examples/Webparts/media-library/~/getmedia/631cd5be-7309-453a-a2e9-61a035a17034/118.aspx?clientcache=0

The same error exist in image preview!

For example http://magendanet.gr/Examples/Webparts/media-library/media-gallery.aspx

Best regards,
Chris

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/6/2011 2:22:03 AM
   
RE:Media Gallery not showing Images
Hi,

the transformation above works with Image gallery web part, not Media library. According to the provided link you are using Media library. Its transformation should be Community.Transformations.MediaLibrary:


<%@ Register Src="~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx" TagName="MediaFilePreview" TagPrefix="cc1" %>
<div class="mediaItem">
<a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<cc1:MediaFilePreview ID="filePreview" runat="server" maxsidesize="117" width="117" height="117" /></a>

<span class="mediaLibraryDescription">
<a class="imagename" href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<%# HTMLEncode(LimitLength(GetNotEmpty("FileTitle;FileName"), 20, "...")) %></a>
<span>Size:</span> <%# DataHelper.GetSizeString(ValidationHelper.GetLong(Eval("FileSize"), 0)) %>
<span>Uploaded:</span> <%# ((DateTime)Eval("FileCreatedWhen")).ToString("M/d/yyyy") %>
</span>
</div>


This one should display images correctly. Could you please try to replace its content?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
info-business-it - 6/6/2011 8:21:43 AM
   
RE:Media Gallery not showing Images
Hi,
I have replace the content from Community.Transformations.MediaLibrary with the code above but the problem exist I cannot see the image.

The link from the image is wrong wrong url

The correct link should be correct link

Thanks

Chris

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/6/2011 8:58:10 AM
   
RE:Media Gallery not showing Images
Hi Chris,

The path to image is generated by following control (ReloadData method):
~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx.cs

For some reason is ~ added on the beginning of the href part. The relative path is generated only in case the media library files are related to some other site:

//mfi is media file info
mfi.FileSiteID != currentSite.SiteID


Could you please send me the code of this control and tell me what version/hotfix of Kentico you are using?

Thank you,
Ivana Tomanickova

User avatar
Member
Member
info-business-it - 6/6/2011 10:04:27 AM
   
RE:Media Gallery not showing Images
The code from ~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx.cs
my version is 5.0.3784



using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;

using CMS.GlobalHelper;
using CMS.CMSHelper;
using CMS.UIControls;
using CMS.MediaLibrary;
using CMS.SiteProvider;

public partial class CMSModules_MediaLibrary_Controls_LiveControls_MediaFilePreview : MediaFilePreview
{
#region "Variables"

private DataRow mData = null;
private int mWidth = 0;
private int mHeight = 0;
private int mMaxSideSize = 0;

#endregion


#region "Properties"

/// <summary>
/// Output object width (image/video/flash)
/// </summary>
public int Width
{
get
{
return this.mWidth;
}
set
{
this.mWidth = value;
}
}


/// <summary>
/// Output object height (image/video/flash)
/// </summary>
public int Height
{
get
{
return this.mHeight;
}
set
{
this.mHeight = value;
}
}


/// <summary>
/// Output image max side size
/// </summary>
public int MaxSideSize
{
get
{
return this.mMaxSideSize;
}
set
{
this.mMaxSideSize = value;
}
}

#endregion


protected override void OnDataBinding(EventArgs e)
{
base.OnDataBinding(e);
// Get data row
this.mData = GetData(this);
}


protected void Page_PreRender(object sender, EventArgs e)
{
if (this.mData != null)
{
MediaFileInfo mfi = new MediaFileInfo(this.mData);
if (mfi != null)
{
bool completeUrl = false;

// Get the site
SiteInfo si = null;
SiteInfo currentSite = CMSContext.CurrentSite;
if (mfi.FileSiteID == currentSite.SiteID)
{
si = currentSite;
}
else
{
si = SiteInfoProvider.GetSiteInfo(mfi.FileSiteID);
}

if (si != null)
{
// Complete URL only for other site than current
if (si.SiteID != currentSite.SiteID)
{
completeUrl = true;
}

string url = "";

if (this.UseSecureLinks)
{
if (completeUrl)
{
url = MediaFileInfoProvider.GetMediaFileAbsoluteUrl(si.SiteName, mfi.FileGUID, mfi.FileName);
}
else
{
url = MediaFileInfoProvider.GetMediaFileUrl(mfi.FileGUID, mfi.FileName);
}
}
else
{
MediaLibraryInfo li = MediaLibraryInfoProvider.GetMediaLibraryInfo(mfi.FileLibraryID);
if (li != null)
{
if (completeUrl)
{
url = MediaFileInfoProvider.GetMediaFileAbsoluteUrl(si.SiteName, li.LibraryFolder, mfi.FilePath);
}
else
{
url = MediaFileInfoProvider.GetMediaFileUrl(si.SiteName, li.LibraryFolder, mfi.FilePath);
}
}
}

if (this.DisplayActiveContent)
{
if (ImageHelper.IsImage(mfi.FileExtension) && File.Exists(MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath)))
{
// Get new dimensions
int[] newDims = ImageHelper.EnsureImageDimensions(Width, Height, MaxSideSize, mfi.FileImageWidth, mfi.FileImageHeight);

// If dimensions changed use secure link
if ((newDims[0] != mfi.FileImageWidth) || (newDims[1] != mfi.FileImageHeight))
{
if (completeUrl)
{
url = MediaFileInfoProvider.GetMediaFileAbsoluteUrl(si.SiteName, mfi.FileGUID, mfi.FileName);
}
else
{
url = MediaFileInfoProvider.GetMediaFileUrl(mfi.FileGUID, mfi.FileName);
}
}

// Initialize image parameters
ImageParameters imgParams = new ImageParameters();
imgParams.Alt = mfi.FileDescription;
imgParams.Width = newDims[0];
imgParams.Height = newDims[1];
imgParams.Url = url;

this.ltlOutput.Text = CMS.GlobalHelper.MediaHelper.GetImage(imgParams);
}
else if (CMS.GlobalHelper.MediaHelper.IsFlash(mfi.FileExtension))
{
// Initialize flash parameters
FlashParameters flashParams = new FlashParameters();
flashParams.Url = url;
flashParams.Width = this.Width;
flashParams.Height = this.Height;

this.ltlOutput.Text = CMS.GlobalHelper.MediaHelper.GetFlash(flashParams);
}
else if (CMS.GlobalHelper.MediaHelper.IsAudio(mfi.FileExtension))
{
// Initialize audio/video parameters
AudioVideoParameters audioParams = new AudioVideoParameters();
audioParams.Url = url;
audioParams.Width = this.Width;
audioParams.Height = this.Height;
audioParams.Extension = mfi.FileExtension;

this.ltlOutput.Text = CMS.GlobalHelper.MediaHelper.GetAudioVideo(audioParams);
}
else if (CMS.GlobalHelper.MediaHelper.IsVideo(mfi.FileExtension))
{
// Initialize audio/video parameters
AudioVideoParameters videoParams = new AudioVideoParameters();
videoParams.Url = url;
videoParams.Width = this.Width;
videoParams.Height = this.Height;
videoParams.Extension = mfi.FileExtension;

this.ltlOutput.Text = CMS.GlobalHelper.MediaHelper.GetAudioVideo(videoParams);
}
else
{
this.ltlOutput.Text = MediaLibraryHelper.ShowPreviewOrIcon(mfi, this.Width, this.Height, this.MaxSideSize, this.PreviewSuffix, this.IconSet, this.Page);
}
}
else
{
this.ltlOutput.Text = MediaLibraryHelper.ShowPreviewOrIcon(mfi, this.Width, this.Height, this.MaxSideSize, this.PreviewSuffix, this.IconSet, this.Page);
}
}
}
}
}


#region "Private methods"

/// <summary>
/// Returns DataRow from current binding item.
/// </summary>
/// <param name="ctrl">Control</param>
private DataRow GetData(Control ctrl)
{
while (ctrl != null)
{
if (ctrl is IDataItemContainer)
{
return ((DataRowView)((IDataItemContainer)ctrl).DataItem).Row;
}
ctrl = ctrl.Parent;
}
return null;
}

#endregion

}

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/8/2011 4:08:22 AM
   
RE:Media Gallery not showing Images
Hi,

the code if your control is correct. I checked URL you have provided:
http://magendanet.gr/Examples/Webparts/media-library/media-gallery.aspx and it seems that you have already fixed the issue, images are displayed correctly?

Could you please share the solution?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
info-business-it - 6/8/2011 7:57:54 AM
   
RE:Media Gallery not showing Images
Hi,
I found the solution last night but didn't quote this.

The code from Community.Transformations.MediaLibrary (Of the many copies I forgot where I found the)

<%@ Register Src="~/CMSModules/MediaLibrary/Controls/LiveControls/MediaFilePreview.ascx" TagName="MediaFilePreview" TagPrefix="cc1" %>
<div class="mediaItem">
<table>
<tr>
<td class="mediaLibraryPhoto"><a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<cc1:MediaFilePreview ID="filePreview" runat="server" maxsidesize="117" width="117" height="117" /></a>
</td>
</tr>
<tr>
<td class="mediaLibraryDescription">
<a href="<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileDetailUrl(Eval("FileID"))) %>" title="<%# CMS.GlobalHelper.ResHelper.GetString(Convert.ToString(Eval("FileDescription"))) %>">
<%# HTMLEncode(LimitLength(GetNotEmpty("FileTitle;FileName"), 20, "...")) %>
</a><br/>
Size: <%# DataHelper.GetSizeString(ValidationHelper.GetLong(Eval("FileSize"), 0)) %><br/>
Uploaded: <%# ((DateTime)Eval("FileCreatedWhen")).ToString("M/d/yyyy") %>

</td>
</tr>
</table>
<div class="mediaItemBottom"></div>
</div>


And I change on Site Manager -> Settings -> Output filter -> Excluded resolve filter URLs the value from " / " to " " (blank).

I believe I could help to

Chris

User avatar
Member
Member
Erko - 9/29/2011 4:18:50 PM
   
RE:Media Gallery not showing Images
Hello,

It seems that I have the same problem... actualy my images are not displayed on my page uses Kentico MediaLibrary Web Part. As I could understand the problem happens because MediaFilePreview.ascx controll adds wrongly ~ character at the begining of the image path.

I am asking you to send me a solution... I strugaling for 3 days with this problem.

I have also instaled the latest Kentico Hot fix 5.5 R2 41, but with no success.

I am loooking forward to getting any help !

Ernez Ćatović




User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/3/2011 1:21:16 AM
   
RE:Media Gallery not showing Images
Hi,

Just for anybody else reference - in this case this issue was fixed by changing the application pool pipeline mode from integrated to classic mode.

Best regards,
Juraj Ondrus.