Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-05-19 08:05:10 +02:00
parent b958e29288
commit a3e58fecd6
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
---
import { Image } from "@astrojs/image/components";
import { getContentArray } from "../utils/helpers";
import { getImageSrc } from "../utils/payload";
const { content } = Astro.props;
const contentArray = getContentArray(content);
---
@ -13,7 +14,7 @@ const contentArray = getContentArray(content);
} else {
return (
<Image
src={`http://payload:3001/media/${value.src}`}
src={getImageSrc(value.src)}
width={value.width}
height={value.height}
format="webp"

View File

@ -9,3 +9,5 @@ export const getPosts = async () =>
export const getPost = async (id: string) =>
(await (await fetch(`${url}/api/posts/${id}`)).json()) as Post;
export const getImageSrc = (src: string) => `${url}/media/${src}}`;