fix(plugin-md-power): incorrect parse image size

This commit is contained in:
pengzhanbo 2025-03-02 12:15:56 +08:00
parent bfa6c6ac0e
commit 0f4db622f7

View File

@ -118,7 +118,7 @@ export async function imageSizePlugin(
if (!fs.existsSync(filepath)) if (!fs.existsSync(filepath))
return false return false
const { width: w, height: h } = imageSize(filepath) const { width: w, height: h } = imageSize(fs.readFileSync(filepath))
if (!w || !h) if (!w || !h)
return false return false
@ -239,7 +239,7 @@ export async function resolveImageSize(app: App, url: string, remote = false): P
if (url[0] === '/') { if (url[0] === '/') {
const filepath = app.dir.public(url.slice(1)) const filepath = app.dir.public(url.slice(1))
if (fs.existsSync(filepath)) { if (fs.existsSync(filepath)) {
const { width, height } = imageSize(filepath) const { width, height } = imageSize(fs.readFileSync(filepath))
return { width: width!, height: height! } return { width: width!, height: height! }
} }
} }