mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 00:55:48 +01:00
parent
fde9fc2891
commit
e9dc54c4d9
1 changed files with 31 additions and 23 deletions
|
@ -149,6 +149,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||||
if (generateWeb) {
|
if (generateWeb) {
|
||||||
logger.info(`creating web image`);
|
logger.info(`creating web image`);
|
||||||
|
|
||||||
|
try {
|
||||||
if (['image/jpeg'].includes(type)) {
|
if (['image/jpeg'].includes(type)) {
|
||||||
webpublic = await convertToJpeg(path, 2048, 2048);
|
webpublic = await convertToJpeg(path, 2048, 2048);
|
||||||
} else if (['image/webp'].includes(type)) {
|
} else if (['image/webp'].includes(type)) {
|
||||||
|
@ -162,6 +163,9 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||||
} else {
|
} else {
|
||||||
logger.info(`web image not created (not an image)`);
|
logger.info(`web image not created (not an image)`);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
logger.warn(`web image not created (an error occured)`, e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info(`web image not created (from remote)`);
|
logger.info(`web image not created (from remote)`);
|
||||||
}
|
}
|
||||||
|
@ -170,6 +174,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||||
// #region thumbnail
|
// #region thumbnail
|
||||||
let thumbnail: IImage | null = null;
|
let thumbnail: IImage | null = null;
|
||||||
|
|
||||||
|
try {
|
||||||
if (['image/jpeg', 'image/webp'].includes(type)) {
|
if (['image/jpeg', 'image/webp'].includes(type)) {
|
||||||
thumbnail = await convertToJpeg(path, 498, 280);
|
thumbnail = await convertToJpeg(path, 498, 280);
|
||||||
} else if (['image/png'].includes(type)) {
|
} else if (['image/png'].includes(type)) {
|
||||||
|
@ -183,6 +188,9 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||||
logger.error(`GenerateVideoThumbnail failed: ${e}`);
|
logger.error(`GenerateVideoThumbnail failed: ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
logger.warn(`thumbnail not created (an error occured)`, e);
|
||||||
|
}
|
||||||
// #endregion thumbnail
|
// #endregion thumbnail
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue