This commit is contained in:
2025-03-17 20:49:54 +02:00
parent 9eb14f0668
commit eaa46eeda8
5 changed files with 17 additions and 9 deletions
+3 -2
View File
@@ -115,9 +115,10 @@ class GameObjectsManager{
* @param {File} thumbSrc A thumbnail, представително изображение
*/
this.addThumb = async function(object, thumbSrc){
let ext = path.extname(object.asset.ofn).toLowerCase();
let ext = path.extname(thumbSrc).toLowerCase();
console.log(object, thumbSrc, ext);
let dest = `${config.fs.repo}/thumb/${object.id}.webp`;
if (['.jpg', '.png', '.webp'].includes(ext)){
if (['.jpg', '.png', '.webp'].includes(ext) || !ext){
await sharp(thumbSrc).resize({height: 250}).toFile(dest);
}else if (['.mp4', '.avi', '.webv'].includes(ext)){
let frame = 1;