Skip to content
Snippets Groups Projects
Unverified Commit 5172ef24 authored by tamaina's avatar tamaina Committed by GitHub
Browse files

動画はimagemagickで変換できない

parent 760b90a8
No related branches found
No related tags found
No related merge requests found
...@@ -54,8 +54,14 @@ interface ISend { ...@@ -54,8 +54,14 @@ interface ISend {
function thumbnail(data: stream.Readable, type: string, resize: number): ISend { function thumbnail(data: stream.Readable, type: string, resize: number): ISend {
const readable: stream.Readable = (() => { const readable: stream.Readable = (() => {
// 動画か画像であれば // 動画であれば
if (/^(?:video|image)\/.*$/.test(type) || type == 'application/xml') { if (/^video\/.*$/.test(type)) {
// 実装は先延ばし
// 使わないことになったストリームはしっかり取り壊す
data.destroy();
return fs.createReadStream(`${__dirname}/assets/thumbnail-not-available.png`);
// 画像であれば
} else if (/^image\/.*$/.test(type) || type == 'application/xml') {
// 0フレーム目を送る // 0フレーム目を送る
try { try {
return gm(data).selectFrame(0).stream(); return gm(data).selectFrame(0).stream();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment