blob: 7de95db501f6681f86381eea4aeddf7f0da99977 [file] [log] [blame] [edit]
import path from 'node:path'
import sizeOf from 'image-size'
import { getDocsStaticFsPath } from './path'
export function getStaticImageSize(imagePath: string) {
const size = sizeOf(path.join(getDocsStaticFsPath(), imagePath))
if (!size.height || !size.width) {
throw new Error(`Failed to get size of static image at '${imagePath}'.`)
}
return { height: size.height, width: size.width }
}