mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
去除 preload 里的 picture-compressor
This commit is contained in:
@@ -90,6 +90,7 @@
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import pictureCompress from "picture-compressor";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -142,7 +143,7 @@ export default {
|
||||
|
||||
getLocalIcon() {
|
||||
utools.showMainWindow();
|
||||
window.getBase64Ico(this.localIconFile.path).then((dataUrl) => {
|
||||
this.compressingPic(window.getBase64Ico(imgPath)).then((dataUrl) => {
|
||||
dataUrl && this.setIcon(dataUrl);
|
||||
});
|
||||
},
|
||||
@@ -163,7 +164,7 @@ export default {
|
||||
quickcommand
|
||||
.downloadFile(imgUrl, imgPath)
|
||||
.then(() => {
|
||||
window.getBase64Ico(imgPath).then((src) => {
|
||||
this.compressingPic(window.getBase64Ico(imgPath)).then((src) => {
|
||||
callback(src);
|
||||
});
|
||||
})
|
||||
@@ -171,6 +172,16 @@ export default {
|
||||
quickcommand.showMessageBox("图片地址有误!", "error");
|
||||
});
|
||||
},
|
||||
async compressingPic(img, width = 80) {
|
||||
let compressedImage = await pictureCompress({
|
||||
img: img,
|
||||
width: width,
|
||||
height: width,
|
||||
type: "png",
|
||||
quality: 1,
|
||||
});
|
||||
return compressedImage.img;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user