When a person presses the crop button, an overlay with the image cropper functionality is shown for the selected image. I can open the overlay just fine if there is already an image selected, but if i delete the current one and pick another, it won't open and gives me the error:
angular.min.js?cdv=118642105:63 TypeError: Cannot read property 'Value' of undefined
at Object.$scope.openOverlay (extendedmediapicker.controller.js?cdv=118642105:85)
at angular.min.js?cdv=118642105:74
at angular-mobile.js?cdv=118642105:270
at Object.$eval (angular.min.js?cdv=118642105:92)
at Object.$apply (angular.min.js?cdv=118642105:92)
at HTMLAnchorElement.<anonymous> (angular-mobile.js?cdv=118642105:269)
at HTMLAnchorElement.dispatch (jquery.min.js?cdv=118642105:3)
at HTMLAnchorElement.r.handle (jquery.min.js?cdv=118642105:3)
For some reason the media item that is loaded initially have different properties on it, than the one picked after, which means my current way of getting the value is not usable.
$scope.images[0].metaData.umbracoFile.Value
This is where i create and initialize the overlay when the crop button is pressed:
$scope.overlay = {
mediaId: $scope.images.udi,
saving: false,
show: true, //controls whether to show the overlay or not
value: $scope.images[0].metaData.umbracoFile.Value,
config: $scope.images[0].metaData.umbracoFile.Value,
view: '/App_Plugins/ExtendedMediaPicker/cropper.html',
close: function (oldModel) { //when the overlay is closed, dont show
$scope.overlay.show = false;
},
title: 'Image Crops',
submitButtonLabel: 'Save Crops',
submit: function (model) { //when user clicks save crops button
//console.log(model);
$scope.overlay.saving = true;
//do savings...
mediaResource.getById($scope.ids[0])
.then(function (media) {
console.log(media);
//media.name = "I want a new name!";
mediaResource.save(media, false, []).then(function (media) { //save changes to media item, or craete if new
console.log(media);
$scope.overlay.saving = false;
$scope.overlay.show = false;
notificationsService.remove(0);
notificationsService.success("The crops for '" + media.name + "' have been saved");
});
});
$scope.overlay.show = false;
}
}
Unable to open image cropper overlay after deleting and picking new media item
I'm having trouble reopening an image cropper overlay when I delete my currently picked media item and adding another one.
This is how my interface looks: https://i.imgur.com/myypGCd.png
When a person presses the crop button, an overlay with the image cropper functionality is shown for the selected image. I can open the overlay just fine if there is already an image selected, but if i delete the current one and pick another, it won't open and gives me the error:
For some reason the media item that is loaded initially have different properties on it, than the one picked after, which means my current way of getting the value is not usable.
This is where i create and initialize the overlay when the crop button is pressed:
is working on a reply...