From 5172ef247bf5dbd9ef163241cedb565a47a85f4a Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 12 Apr 2018 02:34:51 +0900 Subject: [PATCH] =?UTF-8?q?=E5=8B=95=E7=94=BB=E3=81=AFimagemagick=E3=81=A7?= =?UTF-8?q?=E5=A4=89=E6=8F=9B=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/file/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/file/index.ts b/src/server/file/index.ts index 22370ddd0..658117e3a 100644 --- a/src/server/file/index.ts +++ b/src/server/file/index.ts @@ -54,8 +54,14 @@ interface ISend { function thumbnail(data: stream.Readable, type: string, resize: number): ISend { 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フレーム目を送る try { return gm(data).selectFrame(0).stream();