thumbnailfix
This commit is contained in:
parent
9015070042
commit
9778c4f7ec
26
src/lib.js
26
src/lib.js
|
@ -110,23 +110,31 @@ Lib.prototype.generateThumbs = () => {
|
|||
case "audio/mpeg":
|
||||
case "audio/ogg":
|
||||
case "image/gif":
|
||||
cmd = 'ffmpeg -ss 2 -i '+e.dest+' -vframes 1 -filter "scale=-1:256,crop=128:128" '+thumbnail;
|
||||
break;
|
||||
case "image/png":
|
||||
case "image/jpeg":
|
||||
cmd = 'convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail;
|
||||
break;
|
||||
}
|
||||
exec(cmd, (error) => {
|
||||
exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => {
|
||||
if(error) {
|
||||
Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') '+JSON.stringify(error));
|
||||
Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+')');
|
||||
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail
|
||||
}
|
||||
else {
|
||||
exec('convert '+thumbnail+' -resize "128x128^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => {
|
||||
if(error)
|
||||
Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') 2');
|
||||
else
|
||||
Lib.prototype.log("generated thumbnail for "+e.id+" ("+e.mime+")");
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "image/png":
|
||||
case "image/jpeg":
|
||||
exec('convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => {
|
||||
Lib.prototype.log((error)?'failed thumbnail for '+e.id+' ('+e.mime+')':'generated thumbnail for '+e.id+' ('+e.mime+')');
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Lib.prototype.log = (msg) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user