From 75b216bca569ed4d9498dac2fd39d801870d54e5 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Mon, 30 Mar 2020 14:30:50 +0200 Subject: [PATCH] Removed registerFileResolver methods on image cropper and file upload property editors. --- .../fileupload/fileupload.controller.js | 34 +------------ .../imagecropper/imagecropper.controller.js | 51 ------------------- 2 files changed, 1 insertion(+), 84 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js index ee71a0d2f2..15f8dbf11c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js @@ -41,37 +41,5 @@ }; angular.module("umbraco") - .controller('Umbraco.PropertyEditors.FileUploadController', fileUploadController) - .run(function (mediaHelper, umbRequestHelper, assetsService) { - if (mediaHelper && mediaHelper.registerFileResolver) { - // NOTE: The 'entity' can be either a normal media entity or an "entity" returned from the entityResource - // they contain different data structures so if we need to query against it we need to be aware of this. - mediaHelper.registerFileResolver("Umbraco.UploadField", function (property, entity, thumbnail) { - if (thumbnail) { - if (mediaHelper.detectIfImageByExtension(property.value)) { - - // Get default big thumbnail from image processor - return mediaHelper.getProcessedImageUrl(property.value, - { - animationprocessmode: "first", - cacheBusterValue: moment(entity.updateDate).format("YYYYMMDDHHmmss"), - width: 500 - }) - .then(function (url) { - return url; - }); - } - else { - return null; - } - } - else { - return property.value; - } - }); - - } - }); - - + .controller('Umbraco.PropertyEditors.FileUploadController', fileUploadController); })(); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js index c483e83845..cfb15dc8b7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js @@ -214,55 +214,4 @@ angular.module('umbraco') $scope.$on('$destroy', function () { unsubscribe(); }); - }) - .run(function (mediaHelper, umbRequestHelper) { - if (mediaHelper && mediaHelper.registerFileResolver) { - - //NOTE: The 'entity' can be either a normal media entity or an "entity" returned from the entityResource - // they contain different data structures so if we need to query against it we need to be aware of this. - mediaHelper.registerFileResolver("Umbraco.ImageCropper", function (property, entity, thumbnail) { - if (property.value && property.value.src) { - if (thumbnail === true) { - return mediaHelper.getProcessedImageUrl(property.value.src, - { - animationprocessmode: "first", - mode: "max", - width: 500 - }) - .then(function (url) { - return url; - }); - - } - else { - return property.value.src; - } - - //this is a fallback in case the cropper has been asssigned a upload field - } - else if (angular.isString(property.value)) { - if (thumbnail) { - - if (mediaHelper.detectIfImageByExtension(property.value)) { - - var thumbnailUrl = umbRequestHelper.getApiUrl( - "imagesApiBaseUrl", - "GetBigThumbnail", - [{ originalImagePath: property.value }]); - - return thumbnailUrl; - } - else { - return null; - } - - } - else { - return property.value; - } - } - - return null; - }); - } });