thumbnailfix
This commit is contained in:
parent
9015070042
commit
9778c4f7ec
28
src/lib.js
28
src/lib.js
@ -110,21 +110,29 @@ 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;
|
||||
exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => {
|
||||
if(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":
|
||||
cmd = 'convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail;
|
||||
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;
|
||||
}
|
||||
exec(cmd, (error) => {
|
||||
if(error) {
|
||||
Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') '+JSON.stringify(error));
|
||||
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail
|
||||
}
|
||||
else
|
||||
Lib.prototype.log("generated thumbnail for "+e.id+" ("+e.mime+")");
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user