mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
perf(plugin-md-power): improve image-size
This commit is contained in:
parent
9f1948cf05
commit
0443c6ff05
@ -119,11 +119,16 @@ export async function imageSizePlugin(
|
||||
if (!fs.existsSync(filepath))
|
||||
return false
|
||||
|
||||
const { width: w, height: h } = imageSize(fs.readFileSync(filepath))
|
||||
if (!w || !h)
|
||||
return false
|
||||
try {
|
||||
const { width: w, height: h } = imageSize(fs.readFileSync(filepath))
|
||||
if (!w || !h)
|
||||
return false
|
||||
|
||||
cache.set(filepath, { width: w, height: h })
|
||||
cache.set(filepath, { width: w, height: h })
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user