From b20ed8895ac1f76233f23e8dc051728b24b05a82 Mon Sep 17 00:00:00 2001 From: CNOliverZhang Date: Sat, 25 Sep 2021 01:55:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=E6=97=A0=E6=B3=95=E8=A6=86=E7=9B=96=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- src/renderer/pages/compress.vue | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c40928c..affad39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "potatofield-image-toolkit", - "version": "3.4.0", + "version": "3.4.1", "author": "张志毅", "description": "一个为设计师和摄影师等创意行业从业者设计的多功能图片工具箱。", "copyright": "Copyright © 2021 张志毅", @@ -22,7 +22,7 @@ "appId": "cn.potatofield.imagetoolkit", "artifactName": "potatofield-image-toolkit-${version}.${ext}", "releaseInfo": { - "releaseNotes": "优化图像压缩算法,提升压缩速度,提高压缩比。\n修复了图片加水印工具字体失效的问题。\n修复了消息中心时间显示错误的问题。" + "releaseNotes": "修复了图片压缩工具覆盖保存失败的问题。" }, "publish": [ { diff --git a/src/renderer/pages/compress.vue b/src/renderer/pages/compress.vue index 97da787..0843093 100644 --- a/src/renderer/pages/compress.vue +++ b/src/renderer/pages/compress.vue @@ -202,6 +202,7 @@ import EXIF from 'exif-js' import sharp from 'sharp' const path = require('path') +const fs = require('fs') export default { name: 'compress', @@ -462,8 +463,13 @@ export default { distPath = imageInfo.filepath } let distFullpath = path.join(distPath, distFilename) - parsedImage.toFile(distFullpath).then(() => { - resolve() + parsedImage.toBuffer().then((buffer) => { + fs.writeFile(distFullpath, buffer, (error) => { + if (error) { + this.errorList.push(imageInfo.fullpath) + } + resolve() + }) }).catch(() => { this.errorList.push(imageInfo.fullpath) resolve()