mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-24 16:11:20 +01:00
Add thumbnails quality config
This commit is contained in:
parent
bfdd071001
commit
2c84c93f3d
@ -9,7 +9,7 @@ const enableExtensions = true; //Enables support for TavernAI-extras project
|
||||
const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
|
||||
const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
|
||||
const skipContentCheck = false; // If true, no new default content will be delivered to you.
|
||||
|
||||
const thumbnailsQuality = 95; // Quality of thumbnails. 0-100
|
||||
|
||||
// If true, Allows insecure settings for listen, whitelist, and authentication.
|
||||
// Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
|
||||
@ -47,5 +47,6 @@ module.exports = {
|
||||
securityOverride,
|
||||
skipContentCheck,
|
||||
requestOverrides,
|
||||
thumbnailsQuality,
|
||||
extras,
|
||||
};
|
||||
|
@ -107,8 +107,9 @@ async function generateThumbnail(type, file) {
|
||||
let buffer;
|
||||
|
||||
try {
|
||||
const quality = getConfigValue('thumbnailsQuality', 95);
|
||||
const image = await jimp.read(pathToOriginalFile);
|
||||
buffer = await image.cover(mySize[0], mySize[1]).quality(95).getBufferAsync('image/jpeg');
|
||||
buffer = await image.cover(mySize[0], mySize[1]).quality(quality).getBufferAsync('image/jpeg');
|
||||
}
|
||||
catch (inner) {
|
||||
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);
|
||||
|
Loading…
Reference in New Issue
Block a user