简体   繁体   中英

Setting a Default Size for an ImageField in SPMeta2

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,
    };

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM