feat: add cover selection workflow and docker profiles

This commit is contained in:
2025-11-11 01:49:54 +03:00
parent db7de897a0
commit 98746fab39
11 changed files with 310 additions and 53 deletions

View File

@@ -80,6 +80,23 @@ const cropImage = async (file, normalizedConfig) => {
return { blob, url };
};
const buildCropResult = (imageMeta, blob, url) => ({
id: imageMeta.id,
filename: imageMeta.file?.name || imageMeta.filename,
blob,
url,
order: imageMeta.order,
});
export const cropSingleImage = async (image, config) => {
if (!config || !config.imageWidth) {
throw new Error('Kapak için geçerli bir crop ayarı bulunamadı.');
}
const normalized = normalizeCropConfig(config);
const { blob, url } = await cropImage(image.file, normalized);
return buildCropResult(image, blob, url);
};
export const applyCropToImages = async (images, config) => {
if (!images?.length) {
throw new Error('Önce görsel yüklemelisin.');
@@ -91,13 +108,7 @@ export const applyCropToImages = async (images, config) => {
const results = [];
for (const image of images) {
const { blob, url } = await cropImage(image.file, normalized);
results.push({
id: image.id,
filename: image.file.name,
blob,
url,
order: image.order,
});
results.push(buildCropResult(image, blob, url));
}
return results;
};