Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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