Remove usage of obsolete image URL generation properties (width/height ratio, default crop, upscale and animation process mode)

This commit is contained in:
Ronald Barendse
2021-08-10 11:23:37 +02:00
parent 50d8e74b5b
commit 0b9f1f4f86
10 changed files with 218 additions and 482 deletions

View File

@@ -1,4 +1,4 @@
/**
/**
* @ngdoc service
* @name umbraco.resources.imageUrlGeneratorResource
* @function
@@ -11,14 +11,14 @@
function imageUrlGeneratorResource($http, umbRequestHelper) {
function getCropUrl(mediaPath, width, height, imageCropMode, animationProcessMode) {
function getCropUrl(mediaPath, width, height, imageCropMode) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"imageUrlGeneratorApiBaseUrl",
"GetCropUrl",
{ mediaPath, width, height, imageCropMode, animationProcessMode })),
{ mediaPath, width, height, imageCropMode })),
'Failed to get crop URL');
}

View File

@@ -1,4 +1,4 @@
/**
/**
* @ngdoc service
* @name umbraco.services.mediaHelper
* @description A helper object used for dealing with media items
@@ -408,16 +408,20 @@ function mediaHelper(umbRequestHelper, $http, $log) {
* @param {string} imagePath Raw image path
* @param {object} options Object describing image generation parameters:
* {
* animationProcessMode: <string>
* cacheBusterValue: <string>
* width: <int>
* height: <int>
* focalPoint: {
* left: <int>
* top: <int>
* },
* height: <int>
* mode: <string>
* upscale: <boolean>
* width: <int>
* cacheBusterValue: <string>
* crop: {
* x1: <int>
* x2: <int>
* y1: <int>
* y2: <int>
* },
* }
*/
getProcessedImageUrl: function (imagePath, options) {
@@ -433,18 +437,16 @@ function mediaHelper(umbRequestHelper, $http, $log) {
"GetProcessedImageUrl",
{
imagePath,
animationProcessMode: options.animationProcessMode,
cacheBusterValue: options.cacheBusterValue,
width: options.width,
height: options.height,
focalPointLeft: options.focalPoint ? options.focalPoint.left : null,
focalPointTop: options.focalPoint ? options.focalPoint.top : null,
height: options.height,
mode: options.mode,
upscale: options.upscale || false,
width: options.width,
cacheBusterValue: options.cacheBusterValue,
cropX1: options.crop ? options.crop.x1 : null,
cropX2: options.crop ? options.crop.x2 : null,
cropY1: options.crop ? options.crop.y1 : null,
cropY2: options.crop ? options.crop.y : null
cropY2: options.crop ? options.crop.y2 : null
})),
"Failed to retrieve processed image URL for image: " + imagePath);
}

View File

@@ -306,8 +306,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
if (imgUrl) {
mediaHelper.getProcessedImageUrl(imgUrl,
{
height: newSize.height,
width: newSize.width
width: newSize.width,
height: newSize.height
})
.then(function (resizedImgUrl) {
editor.dom.setAttrib(imageDomElement, 'data-mce-src', resizedImgUrl);
@@ -1522,15 +1522,13 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
args.editor.on('ObjectResized', function (e) {
var srcAttr = $(e.target).attr("src");
var path = srcAttr.split("?")[0];
mediaHelper.getProcessedImageUrl(path,
{
height: e.height,
moded: "max",
width: e.width
})
.then(function (resizedPath) {
$(e.target).attr("data-mce-src", resizedPath);
});
mediaHelper.getProcessedImageUrl(path, {
width: e.width,
height: e.height,
mode: "max"
}).then(function (resizedPath) {
$(e.target).attr("data-mce-src", resizedPath);
});
syncContent();
});