Search code examples
piranha-cms

How do I retrieve image from ImageRegion in Piranha CMS


I'm making a start page and want to let the user change the image for the carousel. The only way I see now to retrieve the image is by its GUID like this:

Index.cshtml

@UI.Content("1d2b6621-b7f4-4857-b131-0adcdceb4a57")

How would I get it by property name? Something like:

@UI.Content("Model.Regions.CarouselImage1.Url")

Solution

  • Assuming that you region "CarouselImage1" is an ImageRegion you can retrieve the image url with the following:

    @UI.Content(Model.Regions.CarouselImage1.Id)