12345678910111213 |
- export function getImageUrl(path: string) {
- const url = new URL(`/src/assets/${path}`, import.meta.url);
- return url.href;
- }
- export const isImage = (url: string) => {
- const last = url.lastIndexOf(".");
- const fileExt = url.substring(last + 1);
- if (["jpg", "jpeg", "png", "gif", "webp"].includes(fileExt)) {
- return true;
- }
- return false;
- };
|