[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

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);
}