karmentena
07/16/2024, 8:39 AMJemayn
07/16/2024, 9:21 AMkarmentena
07/16/2024, 10:15 AMkarmentena
07/16/2024, 1:02 PMJemayn
07/16/2024, 1:06 PMitem.Value<MediaWithCrops>("MainImage")
to get the full image model with all its data properties. To get the url without any crops or image processing you can add .MediaUrl()
to it.
But really you should have a look at the documentation for the media picker to learn more about how it can be configured and how you can render its data on the frontend:
https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3karmentena
07/16/2024, 1:10 PMkarmentena
07/16/2024, 1:12 PMkarmentena
07/16/2024, 1:16 PMkarmentena
07/16/2024, 1:16 PMkarmentena
07/16/2024, 1:16 PMkarmentena
07/16/2024, 1:16 PMJemayn
07/16/2024, 1:16 PMx.Value<bool>("isFeature")
will only work if there is both a property with the alias isFeature
and the type of property editor can be cast into a bool. If isFeature for some reason was a blocklist fx it would fail.
The last link I sent you above helps to explain how you can get Umbraco to generate typed models for all document types, so you can then just do fx x.IsFeature and that property will automatically be a bool and your IDE will know that.karmentena
07/16/2024, 1:17 PMJemayn
07/16/2024, 1:18 PM