Fix tag text image generation
This commit is contained in:
parent
1edb480321
commit
68dab11e6b
@ -11,15 +11,14 @@ import { ImageResponse } from 'next/server';
|
|||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
export async function GET(request: Request, context: any) {
|
export async function GET(request: Request, context: any) {
|
||||||
|
const tag = context.params.tag as string;
|
||||||
|
|
||||||
const [
|
const [
|
||||||
photos,
|
photos,
|
||||||
{ fontFamily, fonts },
|
{ fontFamily, fonts },
|
||||||
headers,
|
headers,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getPhotosCached({
|
getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_PER_TAG, tag }),
|
||||||
limit: MAX_PHOTOS_TO_SHOW_PER_TAG,
|
|
||||||
tag: context.params.tag,
|
|
||||||
}),
|
|
||||||
getIBMPlexMonoMedium(),
|
getIBMPlexMonoMedium(),
|
||||||
getImageCacheHeadersForAuth(await auth()),
|
getImageCacheHeadersForAuth(await auth()),
|
||||||
]);
|
]);
|
||||||
@ -27,7 +26,14 @@ export async function GET(request: Request, context: any) {
|
|||||||
const { width, height } = IMAGE_OG_SMALL_SIZE;
|
const { width, height } = IMAGE_OG_SMALL_SIZE;
|
||||||
|
|
||||||
return new ImageResponse(
|
return new ImageResponse(
|
||||||
<TagImageResponse {...{ photos, request, width, height, fontFamily }}/>,
|
<TagImageResponse {...{
|
||||||
|
tag,
|
||||||
|
photos,
|
||||||
|
request,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
fontFamily,
|
||||||
|
}}/>,
|
||||||
{ width, height, fonts, headers },
|
{ width, height, fonts, headers },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,12 +5,14 @@ import ImagePhotoGrid from './components/ImagePhotoGrid';
|
|||||||
import ImageContainer from './components/ImageContainer';
|
import ImageContainer from './components/ImageContainer';
|
||||||
|
|
||||||
export default function TagImageResponse({
|
export default function TagImageResponse({
|
||||||
|
tag,
|
||||||
photos,
|
photos,
|
||||||
request,
|
request,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
fontFamily,
|
fontFamily,
|
||||||
}: {
|
}: {
|
||||||
|
tag: string,
|
||||||
photos: Photo[]
|
photos: Photo[]
|
||||||
request: Request
|
request: Request
|
||||||
width: number
|
width: number
|
||||||
@ -36,7 +38,7 @@ export default function TagImageResponse({
|
|||||||
size={height * .067}
|
size={height * .067}
|
||||||
style={{ transform: `translateY(${height * .02}px)` }}
|
style={{ transform: `translateY(${height * .02}px)` }}
|
||||||
/>
|
/>
|
||||||
<span>{'Door County'.toUpperCase()}</span>
|
<span>{tag.toUpperCase()}</span>
|
||||||
</ImageCaption>
|
</ImageCaption>
|
||||||
</ImageContainer>
|
</ImageContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user