This commit is contained in:
tamaina 2022-01-01 18:00:53 +09:00 committed by GitHub
parent e6c8b83b20
commit 87c5c69c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,7 +160,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
} }
} }
if (!['image/jpeg', 'image/png', 'image/webp'].includes(type)) { if (!['image/jpeg', 'image/png', 'image/webp', 'image/svg+xml'].includes(type)) {
logger.debug(`web image and thumbnail not created (not an required file)`); logger.debug(`web image and thumbnail not created (not an required file)`);
return { return {
webpublic: null, webpublic: null,
@ -201,7 +201,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
webpublic = await convertSharpToJpeg(img, 2048, 2048); webpublic = await convertSharpToJpeg(img, 2048, 2048);
} else if (['image/webp'].includes(type)) { } else if (['image/webp'].includes(type)) {
webpublic = await convertSharpToWebp(img, 2048, 2048); webpublic = await convertSharpToWebp(img, 2048, 2048);
} else if (['image/png'].includes(type)) { } else if (['image/png', 'image/svg+xml'].includes(type)) {
webpublic = await convertSharpToPng(img, 2048, 2048); webpublic = await convertSharpToPng(img, 2048, 2048);
} else { } else {
logger.debug(`web image not created (not an required image)`); logger.debug(`web image not created (not an required image)`);
@ -220,7 +220,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
try { try {
if (['image/jpeg', 'image/webp'].includes(type)) { if (['image/jpeg', 'image/webp'].includes(type)) {
thumbnail = await convertSharpToJpeg(img, 498, 280); thumbnail = await convertSharpToJpeg(img, 498, 280);
} else if (['image/png'].includes(type)) { } else if (['image/png', 'image/svg+xml'].includes(type)) {
thumbnail = await convertSharpToPngOrJpeg(img, 498, 280); thumbnail = await convertSharpToPngOrJpeg(img, 498, 280);
} else { } else {
logger.debug(`thumbnail not created (not an required file)`); logger.debug(`thumbnail not created (not an required file)`);