I want to use my image processing pipeline in the Views/Partials/Grid/Editors/Media.cshtml Especially generate several image URLs for img url set, so on each device it would display optimal image. I realized the model is Newtonsoft.Json.Linq.JObject and payload looks something like this
Because you have the 'id' of the media item, you can use the UmbracoHelper's 'Media' method to pull back the full Media Object to then use with Url.GetCropUrl to obtain the different urls for the different crops.
First thing's first... getting access to the UmbracoHelper in a grid editor partial view, you need to change
@model dynamic
at the top of the partial view to be
@inherits UmbracoViewPage<dynamic>
This will give you access to the UmbracoHelper via the 'Umbraco' property, and you will be able to write:
var mediaItem = Umbraco.Media((int)Model.value.id);
to retrieve the full media item to use in conjunction with GetCropUrl eg:
Use image cropper inside of Grid's Media editor
I want to use my image processing pipeline in the
Views/Partials/Grid/Editors/Media.cshtml
Especially generate several image URLs for img url set, so on each device it would display optimal image. I realized the model isNewtonsoft.Json.Linq.JObject
and payload looks something like thisCan someone please point me to the direction of getting reference of media Item, so I can use
For example..
Thanks!
Hi Vojtech
Because you have the 'id' of the media item, you can use the UmbracoHelper's 'Media' method to pull back the full Media Object to then use with Url.GetCropUrl to obtain the different urls for the different crops.
First thing's first... getting access to the UmbracoHelper in a grid editor partial view, you need to change
at the top of the partial view to be
This will give you access to the UmbracoHelper via the 'Umbraco' property, and you will be able to write:
to retrieve the full media item to use in conjunction with GetCropUrl eg:
regards
Marc
Thank you very much, you rock!
is working on a reply...