mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Don't crash the server on failed thumbnail generation
This commit is contained in:
@@ -1887,8 +1887,13 @@ async function generateThumbnail(type, file) {
|
|||||||
const imageSizes = { 'bg': [160, 90], 'avatar': [96, 144] };
|
const imageSizes = { 'bg': [160, 90], 'avatar': [96, 144] };
|
||||||
const mySize = imageSizes[type];
|
const mySize = imageSizes[type];
|
||||||
|
|
||||||
|
try {
|
||||||
const image = await jimp.read(pathToOriginalFile);
|
const image = await jimp.read(pathToOriginalFile);
|
||||||
await image.cover(mySize[0], mySize[1]).quality(95).writeAsync(pathToCachedFile);
|
await image.cover(mySize[0], mySize[1]).quality(95).writeAsync(pathToCachedFile);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return pathToCachedFile;
|
return pathToCachedFile;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user