[ImageCDN] Copy if failed to use ImageMagick

This commit is contained in:
Ducko 2021-07-01 20:25:00 +01:00 committed by Alyxia Sother
parent ae21d6d6cc
commit f2ac90299c
No known key found for this signature in database
GPG Key ID: 355968D14144B739
1 changed files with 6 additions and 1 deletions

View File

@ -31,7 +31,12 @@ export default (manifest) => {
});
if (rawExt !== 'gif') {
await new Promise((res) => exec(`convert "${rawFile}" -resize x720 -quality 90 "${finalFile}"`, res));
try {
await new Promise((res) => exec(`convert "${rawFile}" -resize x720 -quality 90 "${finalFile}"`, res));
} catch (e) {
console.error('Failed to use ImageMagick to resize and compress, copying file as backup');
copyFileSync(rawFile, finalFile);
}
} else {
copyFileSync(rawFile, finalFile);
}