Files
developer-roadmap/src/lib/image.ts
T
Arik ChakmaandKamran Ahmed d0bd4d6faf feat: implement open graph (#5340)
* chore: add open graph images

* fix: open graph function

* fix: open graph query params

* fix: remove guide id

* fix: generate images on build time

* fix: external author image

* fix: special character issue

---------

Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
2024-03-19 03:33:04 +00:00

13 lines
327 B
TypeScript

import imageSize from 'image-size';
import { readFile } from 'node:fs/promises';
export async function getLocalImageDimensions(path: string) {
try {
const imageBuffer = await readFile(path);
return imageSize(imageBuffer);
} catch (error) {
console.error(error, (error as Error)?.stack);
return null;
}
}