Merge branch 'flatwebp' into develop

This commit is contained in:
chimiana 2022-12-17 02:27:43 +00:00
commit 52070e788e
2 changed files with 4 additions and 2 deletions

View File

@ -217,8 +217,10 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
logger.info('creating web image'); logger.info('creating web image');
try { try {
if (['image/jpeg', 'image/webp'].includes(type)) { if (['image/jpeg'].includes(type)) {
webpublic = await convertSharpToJpeg(img, 2048, 2048); webpublic = await convertSharpToJpeg(img, 2048, 2048);
} else if (['image/webp'].includes(type)) {
webpublic = await convertSharpToPng(img, 2048, 2048);
} else if (['image/png'].includes(type)) { } else if (['image/png'].includes(type)) {
webpublic = await convertSharpToPng(img, 2048, 2048); webpublic = await convertSharpToPng(img, 2048, 2048);
} else if (['image/svg+xml'].includes(type)) { } else if (['image/svg+xml'].includes(type)) {

View File

@ -18,7 +18,7 @@ export const uploads = ref<Uploading[]>([]);
const compressTypeMap = { const compressTypeMap = {
'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' }, 'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' },
'image/webp': { quality: 0.85, mimeType: 'image/jpeg' }, 'image/webp': { quality: 0.85, mimeType: 'image/png' },
'image/svg+xml': { quality: 1, mimeType: 'image/png' }, 'image/svg+xml': { quality: 1, mimeType: 'image/png' },
} as const; } as const;