Monday, October 27, 2014

Sitecore media (images) not rendering

In Sitecore 7.5 I have come across an issue where some images in the media library are not rendering. This is occurring with the image URL given by Sitecore.Resources.Media.MediaManager.GetMediaUrl(MediaItem) and that URL will not load. After some investigation I found that in the sitecore web.config I had used the encodeNameReplacements section to rewrite all spaces as hyphens in URLs. That means that any media images with hyphens in the file name will not load because sitecore is then looking up that media with spaces instead of hyphens (and the image is then not found).

The solution is this case was to not use any hyphens in media file names.

No comments:

Post a Comment