enhance: ドライブに画像ファイルをアップロードするときオリジナル画像を破棄してwebpublicのみ保持するオプション (#8216)
* wip * Update packages/client/src/os.ts Co-authored-by: tamaina <tamaina@hotmail.co.jp> * メニューをComposition API化、switchアイテム追加 クライアントサイド画像圧縮の準備 * メニュー型定義を分離 (TypeScriptの型支援が効かないので) * disabled * make keepOriginal to follow setting value * ✌️ * fix * fix * ✌️ * WEBP * aaa * ✌️ * webp * lazy load browser-image-resizer * rename * rename 2 * Fix * clean up * add comment * clean up * jpeg, pngにもどす * fix * fix name * webpでなくする ただしサムネやプレビューはwebpのまま (テスト) * 動画サムネイルはjpegに * エラーハンドリング * ✌️ * v2.2.1-misskey-beta.2 * browser-image-resizer#v2.2.1-misskey.1 * ✌️ * fix alert * update browser-image-resizer to v2.2.1-misskey.2 * lockfile Co-authored-by: mei23 <m@m544.net> Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
This commit is contained in:
@ -11,7 +11,7 @@ import { DriveFiles } from '@/models/index.js';
|
||||
import { InternalStorage } from '@/services/drive/internal-storage.js';
|
||||
import { downloadUrl } from '@/misc/download-url.js';
|
||||
import { detectType } from '@/misc/get-file-info.js';
|
||||
import { convertToJpeg, convertToPng, convertToPngOrJpeg } from '@/services/drive/image-processor.js';
|
||||
import { convertToWebp, convertToJpeg, convertToPng } from '@/services/drive/image-processor.js';
|
||||
import { GenerateVideoThumbnail } from '@/services/drive/generate-video-thumbnail.js';
|
||||
import { StatusError } from '@/misc/fetch.js';
|
||||
import { FILE_TYPE_BROWSERSAFE } from '@/const.js';
|
||||
@ -64,10 +64,8 @@ export default async function(ctx: Koa.Context) {
|
||||
|
||||
const convertFile = async () => {
|
||||
if (isThumbnail) {
|
||||
if (['image/jpeg', 'image/webp'].includes(mime)) {
|
||||
return await convertToJpeg(path, 498, 280);
|
||||
} else if (['image/png', 'image/svg+xml'].includes(mime)) {
|
||||
return await convertToPngOrJpeg(path, 498, 280);
|
||||
if (['image/jpeg', 'image/webp', 'image/png', 'image/svg+xml'].includes(mime)) {
|
||||
return await convertToWebp(path, 498, 280);
|
||||
} else if (mime.startsWith('video/')) {
|
||||
return await GenerateVideoThumbnail(path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user