Hi
Just wondering if I could get some help. I am trying to develop some custom grid controls. I would like to add either the media picker or image cropper into the control.
I've been looking at the following answer from Christian Haase (https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/97499-media-picker-in-grid-editor)
$scope.showMediaPicker = function () {
var mediaPickerOptions = {
multiPicker: false,
show: false,
submit: function (model) {
var data = model.selection[0];
setImage(data)
editorService.close();
},
close: function () {
editorService.close();
}
}
editorService.mediaPicker(mediaPickerOptions);
}
function setImage(image) {
if (!image) {
$scope.control.value.imageId = 0;
$scope.image = null;
$scope.imageUrl = null;
return;
}
$scope.control.value.imageId = image.id;
$scope.image = image;
$scope.imageUrl = (image.image ? image.image : mediaHelper.resolveFileFromEntity(image)) + '?width=' + 500 + '&mode=crop';
}
Ive added this into the controller on my custom control. However just wondering how should the html look. I cant get it to show the mediaPickerOverlay.
Any help on this would be fantastic. Ive read through a lot of articles but they are mostly for v7
Media Picker - Custom Grid Controls
Hi Just wondering if I could get some help. I am trying to develop some custom grid controls. I would like to add either the media picker or image cropper into the control.
I've been looking at the following answer from Christian Haase (https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/97499-media-picker-in-grid-editor)
Ive added this into the controller on my custom control. However just wondering how should the html look. I cant get it to show the mediaPickerOverlay.
Any help on this would be fantastic. Ive read through a lot of articles but they are mostly for v7
v8:
But couldn't get the media picker to work.
Appreciate any help you guys can offer and thanks in advance.
hey, i think this article may help u to understand more of what u are trying to do. it can explain how to hide/uhide some items of the html. hope it helps. good luck. https://24days.in/umbraco-cms/2016/custom-list-view-layouts/
I got there in the end. Any comments on code more than welcome.
The user is presented with an option to float the image left or right, description and the media box (like the media controller
Controller
Html
cshtml
For anyone looking to create this highly recommend Paul Seals series on creating property editors https://www.youtube.com/watch?v=hqdyz8toI2g
And to look at the umbraco code base https://github.com/umbraco/Umbraco-CMS/blob/650ef397802a5282b61191783dab0d5eb41b5d00/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js
Lori, thanks for sharing this, saved me loads of time!
is working on a reply...