Package Updates
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import fs from "fs-extra";
|
||||
import { access } from "fs/promises";
|
||||
import imageThumbnail from "image-thumbnail";
|
||||
import path from "path";
|
||||
import gm from "gm";
|
||||
import ft from "file-type";
|
||||
import core from "file-type/core";
|
||||
import fs from "fs-extra";
|
||||
import { access } from "fs/promises";
|
||||
import gm from "gm";
|
||||
import imageThumbnail from "image-thumbnail";
|
||||
import path from "path";
|
||||
import { logger } from "../server";
|
||||
import GenerateUrl from "./MediaUrlGen";
|
||||
import { AssetPaths, FolderPaths } from "./serverInit";
|
||||
import { logger } from "../server";
|
||||
const simpleThumb = require("simple-thumbnail");
|
||||
//const ffmpeg = require("ffmpeg-static");
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function GenerateThumbnail(
|
||||
file: string
|
||||
//thumbPath: string
|
||||
) {
|
||||
const type: core.FileTypeResult | undefined = await ft.fromFile(file);
|
||||
const type: core.FileTypeResult | undefined = await ft.fileTypeFromFile(file);
|
||||
let thumbnailExtension: string = GetThumbnailExtension(type);
|
||||
let thumbPath: string = path.join(
|
||||
path.dirname(file),
|
||||
@@ -54,7 +54,7 @@ export default async function GenerateThumbnail(
|
||||
responseType: "buffer",
|
||||
height: 250,
|
||||
width: 250,
|
||||
failOnError: false,
|
||||
failOnError: false
|
||||
});
|
||||
console.log("Image success.");
|
||||
await fs.writeFile(thumbPath, thumbnail);
|
||||
@@ -64,7 +64,7 @@ export default async function GenerateThumbnail(
|
||||
logger.error("Error when genenerating thumbnail:", {
|
||||
thumbPath,
|
||||
err,
|
||||
message: (err as Error).message,
|
||||
message: (err as Error).message
|
||||
});
|
||||
return path.relative(path.dirname(file), AssetPaths.File);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user