From 0c71aa1678645e7ebbcb528ae5faa109fa295e5c Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 22 May 2024 23:41:56 +0100 Subject: [PATCH] Added `requestThumbnailUrls` to imaging repository To move the `imagingModel` configuration into the repository. --- .../packages/core/imaging/imaging.repository.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/imaging/imaging.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/core/imaging/imaging.repository.ts index a675e2ff5e..b608a5e7bd 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/imaging/imaging.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/imaging/imaging.repository.ts @@ -1,7 +1,8 @@ import type { UmbImagingModel } from './types.js'; import { UmbImagingServerDataSource } from './imaging.server.data.js'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; +import { ImageCropModeModel } from '@umbraco-cms/backoffice/external/backend-api'; +import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbApi } from '@umbraco-cms/backoffice/extension-api'; export class UmbImagingRepository extends UmbControllerBase implements UmbApi { @@ -25,4 +26,17 @@ export class UmbImagingRepository extends UmbControllerBase implements UmbApi { const error: any = _error; return { data, error }; } + + /** + * Requests the thumbnail URLs for the given uniques + * @param {Array} uniques + * @param {number} height + * @param {number} width + * @returns {*} + * @memberof UmbImagingRepository + */ + async requestThumbnailUrls(uniques: Array, height: number, width: number) { + const imagingModel = { height: height, width: width, mode: ImageCropModeModel.MIN }; + return await this.requestResizedItems(uniques, imagingModel); + } }