mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-17 08:54:19 +08:00
弃用jimp
This commit is contained in:
@@ -145,6 +145,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pictureCompress from "picture-compressor";
|
||||
|
||||
export default {
|
||||
name: "PersonalizeMenu",
|
||||
@@ -169,8 +170,9 @@ export default {
|
||||
const file =
|
||||
mode === "light" ? this.selectFileLight : this.selectFileDark;
|
||||
if (!file) return;
|
||||
|
||||
const processedImage = await window.imageProcessor(file.path);
|
||||
const processedImage = await this.compressingPic(
|
||||
window.resolveFileToBase64(file.path)
|
||||
);
|
||||
|
||||
if (mode === "light") {
|
||||
this.$root.profile.backgroundImgLight = processedImage;
|
||||
@@ -188,6 +190,16 @@ export default {
|
||||
this.$root.profile.glassEffect = val;
|
||||
this.$root.saveProfile();
|
||||
},
|
||||
async compressingPic(img) {
|
||||
let compressedImage = await pictureCompress({
|
||||
img: img,
|
||||
width: 1280,
|
||||
height: 720,
|
||||
type: "jpg",
|
||||
quality: 0.8,
|
||||
});
|
||||
return compressedImage.img;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -92,7 +92,8 @@ export default {
|
||||
options: ref(null),
|
||||
loading: false,
|
||||
icon8: {
|
||||
platform: "office80,color,fluent,nolan,3d-fluency,isometric,emoji,dusk,stickers,plasticine,bubbles,cotton,clouds,doodle,arcade,pulsar-color,clr-gls,ultraviolet,flat_round,parakeet,neon,matisse,tiny-color,stencil,avantgarde,water-color,retro,3d-plastilina,stitch",
|
||||
platform:
|
||||
"office80,color,fluent,nolan,3d-fluency,isometric,emoji,dusk,stickers,plasticine,bubbles,cotton,clouds,doodle,arcade,pulsar-color,clr-gls,ultraviolet,flat_round,parakeet,neon,matisse,tiny-color,stencil,avantgarde,water-color,retro,3d-plastilina,stitch",
|
||||
amount: "300",
|
||||
baseUrl: "https://search.icons8.com/api/iconsets/v5/search",
|
||||
},
|
||||
@@ -158,7 +159,7 @@ export default {
|
||||
this.localIconFile.slice(-4) === ".exe"
|
||||
)
|
||||
return this.setIcon(utools.getFileIcon(this.localIconFile));
|
||||
this.compressingPic(window.getBase64Ico(this.localIconFile)).then(
|
||||
this.compressingPic(window.resolveFileToBase64(this.localIconFile)).then(
|
||||
(dataUrl) => {
|
||||
dataUrl && this.setIcon(dataUrl);
|
||||
}
|
||||
@@ -177,13 +178,15 @@ export default {
|
||||
argvs: imgUrl,
|
||||
readfile: false,
|
||||
});
|
||||
let imgPath = window.getQuickcommandTempFile(imgInfo.ext, 'TempImgFile');
|
||||
let imgPath = window.getQuickcommandTempFile(imgInfo.ext, "TempImgFile");
|
||||
quickcommand
|
||||
.downloadFile(imgUrl, imgPath)
|
||||
.then(() => {
|
||||
this.compressingPic(window.getBase64Ico(imgPath)).then((src) => {
|
||||
callback(src);
|
||||
});
|
||||
this.compressingPic(window.resolveFileToBase64(imgPath)).then(
|
||||
(src) => {
|
||||
callback(src);
|
||||
}
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
quickcommand.showMessageBox("图片地址有误!", "error");
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
};
|
||||
try {
|
||||
let res = await quickcommand.downloadFile(iconUrl, iconPath);
|
||||
if (res) command.features.icon = window.getBase64Ico(iconPath);
|
||||
if (res) command.features.icon = window.resolveFileToBase64(iconPath);
|
||||
} catch (e) {}
|
||||
this.importCommand(command);
|
||||
utools.showNotification("操作成功!");
|
||||
|
||||
@@ -120,7 +120,7 @@ export default {
|
||||
features: {
|
||||
cmds: this.nickName,
|
||||
explain: this.feature.explain,
|
||||
icon: window.getBase64Ico(this.plugin.logoPath),
|
||||
icon: window.resolveFileToBase64(this.plugin.logoPath),
|
||||
platform: this.plugin.platform || ["darwin", "win32", "linux"],
|
||||
code: `key_${uid}`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user