Setting a Default Size for an ImageField in SPMeta2

94 Views Asked by At

I'm new to SharePoint and SPMeta2. I would like to give this ImageField that I've created with SPMeta2 a default size of 300x300 since its always too big if you let people choose their own size.

    public static FieldDefinition ContactPicture = new ImageFieldDefinition
    {
        Id = new Guid("ATD3DCAD-2A70-49AC-AFB7-BF4D2EDA5627"),
        Title = "Kontaktfoto",
        InternalName = "ContactPicture",
        Required = false,
        Hidden = false,
        ShowInNewForm = true,
        ShowInEditForm = true,
        ShowInDisplayForm = true,
        Group = GroupNames.ContentTypeGroupName,
    };
1

There are 1 best solutions below

0
On

We don't seem to be able to control these settings over field's properties or field's XML definition. It seems that Width/Height are controlled by RichHtmlField control on the target publishing page layout.

In your case, you would need to update RichImageField control properties on the target publishing page layout as per the following suggestion:

https://sharepoint.stackexchange.com/questions/156079/how-to-force-width-and-height-of-an-image-in-the-pagelayout

<PublishingWebControls:RichImageField ID="newsArticleImage" runat="server" FieldName="PublishingRollupImage" DisplayWidth="500" DisplayHeight="500"/>

Other ways might also include various css/javascript tricks, hope that points to the right direction.