弃用jimp

This commit is contained in:
fofolee
2024-12-30 19:49:28 +08:00
parent 5e2994fe6d
commit 7a79d3a443
10 changed files with 225 additions and 1904 deletions

View File

@@ -3,19 +3,17 @@ const path = require("path");
const iconv = require("iconv-lite");
const child_process = require("child_process");
const getBase64Ico = (filepath) => {
let sourceImage,
const resolveFileToBase64 = (filepath) => {
let imageBase64,
ext = path.extname(filepath).slice(1);
if (["png", "jpg", "jpeg", "bmp", "ico", "gif", "svg"].includes(ext)) {
if (ext == "svg") ext = "svg+xml";
sourceImage =
imageBase64 =
`data:image/${ext};base64,` + fs.readFileSync(filepath, "base64");
if (ext == "png") return sourceImage;
} else {
sourceImage = window.utools.getFileIcon(filepath);
return sourceImage;
imageBase64 = window.utools.getFileIcon(filepath);
}
return sourceImage;
return imageBase64;
};
const getFileInfo = (options) => {
@@ -98,7 +96,7 @@ const convertFilePathToUtoolsPayload = (files) => {
};
module.exports = {
getBase64Ico,
resolveFileToBase64,
getFileInfo,
getCurrentFolderPathFix,
saveFile,