diff --git a/app/controllers/images_controller.ts b/app/controllers/images_controller.ts index bdde60f..a0e47c0 100644 --- a/app/controllers/images_controller.ts +++ b/app/controllers/images_controller.ts @@ -3,12 +3,13 @@ import { generateScoreImage, generateLeaderboardImage, generateFollowersImage, + generateIntroMessage, } from '#services/generate_image' import sharp from 'sharp' export default class ImagesController { - async show({ params, response }: HttpContext) { - const svg = await generateScoreImage(params.id) + async show({ response }: HttpContext) { + const svg = await generateIntroMessage() const pngBuffer = await sharp(Buffer.from(svg)).toFormat('png').toBuffer() response.header('Content-type', 'image/png') diff --git a/app/services/generate_image.ts b/app/services/generate_image.ts index b45d303..249745c 100644 --- a/app/services/generate_image.ts +++ b/app/services/generate_image.ts @@ -65,7 +65,9 @@ export const generateScoreImage = async (fid: number) => { height: '100%', justifyContent: 'center', alignItems: 'center', - backgroundColor: 'black', + backgroundImage: "url('https://farscout.xyz/images/thumbnail.png')", + backgroundSize: 'cover', + backgroundPosition: 'center', }, }, }, @@ -167,7 +169,9 @@ export const generateLeaderboardImage = async () => { height: '100%', justifyContent: 'center', alignItems: 'center', - backgroundColor: 'black', + backgroundImage: "url('https://farscout.xyz/images/thumbnail.png')", + backgroundSize: 'cover', + backgroundPosition: 'center', }, }, }, @@ -272,7 +276,89 @@ export const generateFollowersImage = async (fid: number) => { height: '100%', justifyContent: 'center', alignItems: 'center', - backgroundColor: 'black', + backgroundImage: "url('https://farscout.xyz/images/thumbnail.png')", + backgroundSize: 'cover', + backgroundPosition: 'center', + }, + }, + }, + { + width: 675, + height: 675, + fonts: [ + { + data: regularFontData, + name: 'SpaceGrotesk-Regular', + }, + { + data: boldFontData, + name: 'SpaceGrotesk-SemiBold', + }, + ], + } + ) +} + +export const generateIntroMessage = async () => { + const regularFontPath = join(process.cwd(), '/public/font', 'SpaceGrotesk-Regular.ttf') + const regularFontData = fs.readFileSync(regularFontPath) + + const boldFontPath = join(process.cwd(), '/public/font', 'SpaceGrotesk-SemiBold.ttf') + const boldFontData = fs.readFileSync(boldFontPath) + + return await satori( + { + type: 'div', + props: { + children: [ + { + type: 'p', + props: { + children: `farscout.xyz`, + style: { + fontSize: 24, + fontFamily: 'SpaceGrotesk-regular', + color: 'white', + zIndex: 1, + }, + }, + }, + { + type: 'p', + props: { + children: `a simple reputation frame built on top of`, + style: { + fontSize: 24, + fontFamily: 'SpaceGrotesk-regular', + color: 'white', + zIndex: 1, + }, + }, + }, + { + type: 'p', + props: { + children: `farcaster and airstack`, + style: { + fontSize: 24, + fontFamily: 'SpaceGrotesk-SemiBold', + color: 'white', + zIndex: 1, + }, + }, + }, + ], + style: { + display: 'flex', + flexDirection: 'column', + position: 'relative', + width: '100%', + height: '100%', + justifyContent: 'center', + alignItems: 'center', + backgroundImage: "url('https://farscout.xyz/images/thumbnail.png')", + backgroundSize: 'cover', + backgroundPosition: 'center', }, }, }, diff --git a/public/images/main.png b/public/images/main.png new file mode 100644 index 0000000..f0bab47 Binary files /dev/null and b/public/images/main.png differ diff --git a/public/images/thumbnail.png b/public/images/thumbnail.png index de689b6..9399d8b 100644 Binary files a/public/images/thumbnail.png and b/public/images/thumbnail.png differ diff --git a/resources/views/pages/home.edge b/resources/views/pages/home.edge index e1db89d..080892d 100644 --- a/resources/views/pages/home.edge +++ b/resources/views/pages/home.edge @@ -6,7 +6,7 @@