Removed registerFileResolver methods on image cropper and file upload property editors.

This commit is contained in:
Andy Butland
2020-03-30 14:30:50 +02:00
parent 1760241607
commit 75b216bca5
2 changed files with 1 additions and 84 deletions

View File

@@ -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);
})();

View File

@@ -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;
});
}
});