Display Image from Media Library in Umbraco 7

后端 未结 8 2058
野性不改
野性不改 2021-02-04 00:22

This should be something embarrassingly simple, but I can\'t get it to work: I\'d simply like to display an image that was uploaded to the Umbraco Media Library (Umbraco 7.1.1)

8条回答
  •  花落未央
    2021-02-04 01:00

    I entered this into the section above the doctype in the template or master being used.

    @{
    Layout = null;
    var regionalPage = Umbraco.Content(this.CurrentPage.Id);
    string manangerPhotoUrl = string.Format("https://assets.yourdomain.com{0}", @Umbraco.Media(regionalPage.managerPhoto).Url);
    }
    

    Then I added the variable holding the string value to my image source attribute in the markup.

    
    

提交回复
热议问题