1

I have a custom Publishing Image field defined as

 <Field ID="{621EC4B5-457F-4B64-B2F1-6F568F6BFA60}" Name="ContentImage1"
 SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentImage1" 
 Group="My Custom Columns" DisplayName="ContentImage1" Type="Image" 
 Format="Image" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" 
 Sortable="FALSE" /> 

When using the publishing image field in a page layout it adds extra closing divs which breaks the layout of the page. Weirdly if you then edit the page it fixes it - it fixes the edited page but not the content deployed version of the page (unless you edit it too - which is pointless as it will be overwritten next time the page is deployed)

I've tried using the RichImageField control and the FieldValue control both of which render

<img alt="Learning" height="200" src="/Learn/PublishingImages/theatre880.jpg" 
width="880" style="border:0px solid" /></div></div>

This was proven by wrapping the SharePoint controls in a <span>....</span> and still finding the offending divs in there.

Any ideas?

Is there any way (in a publishing page layout) to get just the url of the image rather than the whole tag?

1 Answer 1

1

The only way around this is to create a custom control that inherits RichImageField and overrides the rendering (e.g. RenderFieldForDisplay method).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.