From 0f4db622f791c92aa1bfb78e3b3451b51fd83367 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 2 Mar 2025 12:15:56 +0800 Subject: [PATCH] fix(plugin-md-power): incorrect parse image size --- plugins/plugin-md-power/src/node/enhance/imageSize.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/plugin-md-power/src/node/enhance/imageSize.ts b/plugins/plugin-md-power/src/node/enhance/imageSize.ts index a2fe913f..7d20a1d0 100644 --- a/plugins/plugin-md-power/src/node/enhance/imageSize.ts +++ b/plugins/plugin-md-power/src/node/enhance/imageSize.ts @@ -118,7 +118,7 @@ export async function imageSizePlugin( if (!fs.existsSync(filepath)) return false - const { width: w, height: h } = imageSize(filepath) + const { width: w, height: h } = imageSize(fs.readFileSync(filepath)) if (!w || !h) return false @@ -239,7 +239,7 @@ export async function resolveImageSize(app: App, url: string, remote = false): P if (url[0] === '/') { const filepath = app.dir.public(url.slice(1)) if (fs.existsSync(filepath)) { - const { width, height } = imageSize(filepath) + const { width, height } = imageSize(fs.readFileSync(filepath)) return { width: width!, height: height! } } }