Files
Umbraco-CMS/src/Umbraco.Web.UI.Client/src/common/resources/imageurlgenerator.resource.js
2020-02-08 16:49:12 -08:00

37 lines
1006 B
JavaScript

/**
* @ngdoc service
* @name umbraco.resources.imageUrlGeneratorResource
* @function
*
* @description
* Used by the various controllers to get an image URL formatted correctly for the current image URL generator
*/
(function () {
'use strict';
function imageUrlGeneratorResource($http, umbRequestHelper) {
function getCropUrl(mediaPath, width, height, imageCropMode, animationProcessMode) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"imageUrlGeneratorApiBaseUrl",
"GetCropUrl",
{ mediaPath, width, height, imageCropMode, animationProcessMode })),
'Failed to get crop URL');
}
var resource = {
getCropUrl: getCropUrl
};
return resource;
}
angular.module('umbraco.resources').factory('imageUrlGeneratorResource', imageUrlGeneratorResource);
})();