I have a problem using an Image Field in a Page Layout. What I did was the following:
- Created Image Field
- Created Content Type (inherited from Article Page)
- Added the Field to the Content Type and deployed the solution
- Created Page Layout with the Content Type
- Generated a snippet for the Image Field
Field:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field
ID="{4ea31e74-f59d-4ddf-863c-607a01735f65}"
Name="pls_H2_2_Image"
DisplayName="Titel 2 Bild"
Type="Image"
Required="FALSE"
Group="Custom">
</Field>
</Elements>
Generated Snippet (why did the snippet convert > and < ? If I generate the snippet for Page Image (standard article page field) > and < are shown properly):
<div data-name="Page Field: Titel 2 Bild">
<!--CS: Start Page Field: Titel 2 Bild Snippet--><!--SPM:<%@Register Tagprefix="PageFieldRichImageField" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<PageFieldRichImageField:RichImageField FieldName="4ea31e74-f59d-4ddf-863c-607a01735f65" runat="server">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)-->
<div id="ctl02_label" style="display:none">Titel 2 Bild</div>
<div id="ctl02__ControlWrapper_RichImageField" class="ms-rtestate-field" style="display:inline" aria-labelledby="ctl02_label">
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap"><span class="ms-formfieldlabel" nowrap="nowrap">Titel 2 Bild</span></div>
<div class="ms-formfieldvaluecontainer">
<div class="ms-rtestate-field"><img alt="" src="/_layouts/images/home.gif" style="BORDER: px solid; "></div>
</div>
</div>
</div>
<!--PE: End of READ-ONLY PREVIEW--><!--ME:</PageFieldRichImageField:RichImageField>--><!--CE: End Page Field: Titel 2 Bild Snippet-->
</div>
Snippet Preview (note that in fact no picture is displayed, only the code):
Titel 2 Bild
<img alt="" src="/_layouts/images/home.gif" style="BORDER: px solid; ">
Generates the following (Picture selected in edit-mode then saved the page):
I also generated the snippet for the Page Image Field (inherited from Article Page) which works without a problem. I don't understand why my custom Image Field doesn't get displayed while the Page Image does (even the preview of the snippet for the Page Image field already shows a picture and no html img code)
Edit: I added two screenshots to clarify my problem, with the hope that someone will understand and help me.
What "Titel 2 Bild" looks like in the preview:
What "Page Image" looks like (and how "Titel 2 Bild" should look like):