Craig100
09/06/2023, 1:16 PMhuwred
09/06/2023, 1:48 PMAnders Bjerner
09/06/2023, 1:56 PMMediaWithCrops
to the generated model (such as Image
), but MediaWithCrops
has a Content
property that exposes the underlying IPublishedContent
.
A MediaWithCrops
instance is actually also an IPublishedContent
, so you should be able to use mediaWithCrops.Value<int>("umbracoWidth")
.Craig100
09/06/2023, 3:00 PMAnders Bjerner
09/06/2023, 3:08 PMmediaWithCrops.Value<int>("umbracoWidth")
or mediaWithCrops.Content.Value<int>("umbracoWidth")
?huwred
09/06/2023, 3:08 PMmediaWithCrops.Value<int>("umbracoWidth").
worked for me when I tested itCraig100
09/06/2023, 3:08 PMCraig100
09/06/2023, 3:09 PMAnders Bjerner
09/06/2023, 3:09 PMCraig100
09/06/2023, 3:09 PMAnders Bjerner
09/06/2023, 3:10 PMMediaWithCrops
itemhuwred
09/06/2023, 3:10 PMCraig100
09/06/2023, 3:10 PMCraig100
09/06/2023, 3:11 PMCraig100
09/06/2023, 3:13 PMAnders Bjerner
09/06/2023, 3:13 PMCraig100
09/06/2023, 3:13 PMCraig100
09/06/2023, 3:14 PMCraig100
09/06/2023, 4:17 PM@inject IMediaService _mediaService
@{
Layout = null;
foreach (var item in _mediaService.GetByLevel(3)) {
_mediaService.Save(item);
}
}