0

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")
Cœur
  • 37,241
  • 25
  • 195
  • 267
Magnus Karlsson
  • 3,549
  • 3
  • 31
  • 57

1 Answers1

4

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

@UI.Content(Model.Regions.CarouselImage1.Id)
Håkan Edling
  • 2,723
  • 1
  • 12
  • 15
  • Nice! @Model.Regions.CarouselImage1.Name Did the trick but initiated another question.. Saving the image turned it from 1550x500 to 940x345px. Why is that? Even uploading it directly under "Images & Documents" makes it smaller. – Magnus Karlsson Jul 28 '13 at 10:30
  • To optimize images for your current application there's a parameter called IMAGE_MAX_WIDTH. This is set to 940 by default but can set to any number. If you allow large images you can still downsize them when using them in your carousel with @UI.Content(id, width). – Håkan Edling Jul 28 '13 at 10:37