Publishing Images are shown in encoded Html/text instead of showing the image - temporary solution
We came across a random issue lately where a publishing image (RichImageField) does not render correctly in display mode : it shows the IMG tag in Html encoded format rather than the actual image.
We had this issue with both the OOB RollupImage as well as custom columns using the RichImageField; however we cannot determine what the parameters that makes this bug appear and disappear randomly. We ended up creating a workaround similar to another issue with the RichImageField documented by Stefan Gossner at this Url : How To: overcome glitches with the standard field controls shipped with MOSS 2007.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint.Publishing.WebControls;
namespace Customer.SharePoint.WebControls
{
public class WorkaroundRichImageField : RichImageField
{
protected override void RenderFieldForDisplay(System.Web.UI.HtmlTextWriter output)
{
TextWriter textWriter = new StringWriter();
base.RenderFieldForDisplay(new HtmlTextWriter(textWriter));
string fieldHtml = HttpUtility.HtmlDecode(textWriter.ToString());
output.Write(fieldHtml);
}
}
}
You simply need to add that library in the GAC or the BIN and import it in your Page Layouts that uses RichImageField. Drag & Drop the OOB controls to have all the parameters and change their definition to use your class instead of the OOB one and it'll fix the problem.
Maxime