Merge remote-tracking branch 'origin/v9/dev' into v9/dev
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -1526,15 +1526,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();
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
var path = umbRequestHelper.convertVirtualToAbsolutePath(vm.blockConfigModel.thumbnail);
|
||||
if (path.toLowerCase().endsWith(".svg") === false) {
|
||||
path += "?upscale=false&width=400";
|
||||
path += "?width=400";
|
||||
}
|
||||
vm.styleBackgroundImage = 'url(\''+path+'\')';
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(function () {
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@
|
||||
if (thumbnail) {
|
||||
if (mediaHelper.detectIfImageByExtension(property.value)) {
|
||||
//get default big thumbnail from image processor
|
||||
var thumbnailUrl = property.value + "?rnd=" + moment(entity.updateDate).format("YYYYMMDDHHmmss") + "&width=500&animationprocessmode=first";
|
||||
var thumbnailUrl = property.value + "?width=500&rnd=" + moment(entity.updateDate).format("YYYYMMDDHHmmss");
|
||||
return thumbnailUrl;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -70,28 +70,25 @@ angular.module("umbraco")
|
||||
if ($scope.control.value.coordinates) {
|
||||
// New way, crop by percent must come before width/height.
|
||||
var coords = $scope.control.value.coordinates;
|
||||
url += `?crop=${coords.x1},${coords.y1},${coords.x2},${coords.y2}&cropmode=percentage`;
|
||||
url += `?cc=${coords.x1},${coords.y1},${coords.x2},${coords.y2}`;
|
||||
} else {
|
||||
// Here in order not to break existing content where focalPoint were used.
|
||||
// For some reason width/height have to come first when mode=crop.
|
||||
if ($scope.control.value.focalPoint) {
|
||||
url += `?center=${$scope.control.value.focalPoint.top},${$scope.control.value.focalPoint.left}`;
|
||||
url += '&mode=crop';
|
||||
url += `?rxy=${$scope.control.value.focalPoint.left},${$scope.control.value.focalPoint.top}`;
|
||||
} else {
|
||||
// Prevent black padding and no crop when focal point not set / changed from default
|
||||
url += '?center=0.5,0.5&mode=crop';
|
||||
url += '?rxy=0.5,0.5';
|
||||
}
|
||||
}
|
||||
|
||||
url += '&width=' + $scope.control.editor.config.size.width;
|
||||
url += '&height=' + $scope.control.editor.config.size.height;
|
||||
url += '&animationprocessmode=first';
|
||||
}
|
||||
|
||||
// set default size if no crop present (moved from the view)
|
||||
if (url.includes('?') === false)
|
||||
{
|
||||
url += '?width=800&upscale=false&animationprocessmode=false'
|
||||
url += '?width=800'
|
||||
}
|
||||
|
||||
return url;
|
||||
|
||||
@@ -234,7 +234,7 @@ angular.module('umbraco')
|
||||
if (property.value && property.value.src) {
|
||||
|
||||
if (thumbnail === true) {
|
||||
return property.value.src + "?width=500&mode=max&animationprocessmode=first";
|
||||
return property.value.src + "?width=500";
|
||||
}
|
||||
else {
|
||||
return property.value.src;
|
||||
|
||||
Reference in New Issue
Block a user