IO-2039 Add unknown file type thumbnail.
This commit is contained in:
BIN
assets/file.png
Normal file
BIN
assets/file.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -150,6 +150,7 @@ app.post(
|
|||||||
BillRequestValidator,
|
BillRequestValidator,
|
||||||
BillsUploadMedia
|
BillsUploadMedia
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
"/",
|
"/",
|
||||||
ValidateImsToken,
|
ValidateImsToken,
|
||||||
@@ -160,6 +161,7 @@ app.get(
|
|||||||
|
|
||||||
InitServer();
|
InitServer();
|
||||||
app.use(FolderPaths.StaticPath, express.static(FolderPaths.Root, {}));
|
app.use(FolderPaths.StaticPath, express.static(FolderPaths.Root, {}));
|
||||||
|
app.use("/assets", express.static("./assets", {}));
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
logger.info(`ImEX Media Server is running at http://localhost:${port}`);
|
logger.info(`ImEX Media Server is running at http://localhost:${port}`);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import gm from "gm";
|
|||||||
import ft from "file-type";
|
import ft from "file-type";
|
||||||
import core from "file-type/core";
|
import core from "file-type/core";
|
||||||
import GenerateUrl from "./MediaUrlGen";
|
import GenerateUrl from "./MediaUrlGen";
|
||||||
import { FolderPaths } from "./serverInit";
|
import { AssetPaths, FolderPaths } from "./serverInit";
|
||||||
import { logger } from "../server";
|
import { logger } from "../server";
|
||||||
const simpleThumb = require("simple-thumbnail");
|
const simpleThumb = require("simple-thumbnail");
|
||||||
const ffmpeg = require("ffmpeg-static");
|
const ffmpeg = require("ffmpeg-static");
|
||||||
@@ -53,7 +53,7 @@ export default async function GenerateThumbnail(
|
|||||||
height: 250,
|
height: 250,
|
||||||
width: 250,
|
width: 250,
|
||||||
});
|
});
|
||||||
|
console.log("Image success.");
|
||||||
await fs.writeFile(thumbPath, thumbnail);
|
await fs.writeFile(thumbPath, thumbnail);
|
||||||
}
|
}
|
||||||
return path.relative(path.dirname(file), thumbPath);
|
return path.relative(path.dirname(file), thumbPath);
|
||||||
@@ -63,7 +63,7 @@ export default async function GenerateThumbnail(
|
|||||||
err,
|
err,
|
||||||
message: (err as Error).message,
|
message: (err as Error).message,
|
||||||
});
|
});
|
||||||
return path.relative(path.dirname(file), thumbPath);
|
return path.relative(path.dirname(file), AssetPaths.File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ export const FolderPaths = {
|
|||||||
VendorsFolder,
|
VendorsFolder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const AssetPaths = {
|
||||||
|
File: "/assets/file.png",
|
||||||
|
};
|
||||||
|
|
||||||
export function JobRelativeFilePath(jobid: string, filename: string) {
|
export function JobRelativeFilePath(jobid: string, filename: string) {
|
||||||
return path.join(FolderPaths.Jobs, jobid, filename);
|
return path.join(FolderPaths.Jobs, jobid, filename);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user