feat: add og-images.ts
This commit is contained in:
parent
ac431a2b8c
commit
7438703789
1 changed files with 69 additions and 0 deletions
69
og-images.ts
Normal file
69
og-images.ts
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* OG Image Generator — agentify.help only
|
||||
*/
|
||||
import { Resvg } from "@resvg/resvg-js";
|
||||
|
||||
const PNG_CACHE = new Map<string, Buffer>();
|
||||
|
||||
function renderSvgToPng(svg: string): Buffer {
|
||||
const resvg = new Resvg(svg, {
|
||||
fitTo: { mode: "original" },
|
||||
font: { loadSystemFonts: true },
|
||||
});
|
||||
return Buffer.from(resvg.render().asPng());
|
||||
}
|
||||
|
||||
const AGENTIFY_SVG = `<svg width="1200" height="630" viewBox="0 0 1200 630" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="bgGrad3" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#FDFAF4"/>
|
||||
<stop offset="100%" stop-color="#F0EBD8"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="1200" height="630" fill="url(#bgGrad3)"/>
|
||||
<rect width="1200" height="5" fill="#1A2B4A"/>
|
||||
<circle cx="998" cy="210" r="52" fill="#1A2B4A" opacity="0.08"/>
|
||||
<circle cx="998" cy="210" r="40" fill="#1A2B4A" opacity="0.12"/>
|
||||
<circle cx="998" cy="196" r="30" fill="none" stroke="#1A2B4A" stroke-width="2.5" opacity="0.25"/>
|
||||
<path d="M938 300 Q938 258 998 258 Q1058 258 1058 300" fill="none" stroke="#1A2B4A" stroke-width="2.5" opacity="0.25"/>
|
||||
<circle cx="998" cy="196" r="55" fill="none" stroke="#C9962A" stroke-width="1.5" stroke-dasharray="4 8" opacity="0.4"/>
|
||||
<circle cx="998" cy="196" r="80" fill="none" stroke="#C9962A" stroke-width="1" stroke-dasharray="3 12" opacity="0.25"/>
|
||||
<circle cx="1060" cy="148" r="5" fill="#C9962A" opacity="0.6"/>
|
||||
<circle cx="936" cy="148" r="5" fill="#C9962A" opacity="0.6"/>
|
||||
<circle cx="1078" cy="210" r="4" fill="#C9962A" opacity="0.45"/>
|
||||
<circle cx="918" cy="210" r="4" fill="#C9962A" opacity="0.45"/>
|
||||
<line x1="998" y1="166" x2="1060" y2="148" stroke="#C9962A" stroke-width="1.2" opacity="0.3"/>
|
||||
<line x1="998" y1="166" x2="936" y2="148" stroke="#C9962A" stroke-width="1.2" opacity="0.3"/>
|
||||
<rect x="973" y="340" width="50" height="50" rx="6" fill="#1A2B4A" opacity="0.08" stroke="#C9962A" stroke-width="1.5" stroke-opacity="0.35"/>
|
||||
<text x="984" y="372" font-family="Courier New, Courier, monospace" font-size="14" fill="#C9962A" opacity="0.6">AI</text>
|
||||
<rect x="48" y="44" width="178" height="30" rx="4" fill="#1A2B4A" fill-opacity="0.07" stroke="#1A2B4A" stroke-width="1" stroke-opacity="0.2"/>
|
||||
<text x="63" y="63" font-family="Courier New, Courier, monospace" font-size="13" font-weight="700" fill="#1A2B4A" opacity="0.6" letter-spacing="1.5">AGENTIFY.HELP</text>
|
||||
<text x="48" y="196" font-family="Arial, Helvetica, sans-serif" font-size="72" font-weight="900" fill="#1A2B4A">Build the AI expert.</text>
|
||||
<text x="48" y="290" font-family="Arial, Helvetica, sans-serif" font-size="72" font-weight="900" xml:space="preserve"><tspan fill="#C9962A">Once.</tspan><tspan fill="#1A2B4A"> Right.</tspan></text>
|
||||
<rect x="48" y="322" width="80" height="4" fill="#C9962A" rx="2"/>
|
||||
<rect x="48" y="348" width="156" height="58" rx="8" fill="#1A2B4A" fill-opacity="0.05" stroke="#1A2B4A" stroke-width="1" stroke-opacity="0.1"/>
|
||||
<text x="64" y="370" font-family="Courier New, Courier, monospace" font-size="10" fill="#C9962A" letter-spacing="1">CORPUS-GROUNDED</text>
|
||||
<text x="64" y="392" font-family="Arial, Helvetica, sans-serif" font-size="14" fill="#4A5568">Published works only</text>
|
||||
<rect x="220" y="348" width="164" height="58" rx="8" fill="#1A2B4A" fill-opacity="0.05" stroke="#1A2B4A" stroke-width="1" stroke-opacity="0.1"/>
|
||||
<text x="236" y="370" font-family="Courier New, Courier, monospace" font-size="10" fill="#C9962A" letter-spacing="1">ONE-PER-PERSON</text>
|
||||
<text x="236" y="392" font-family="Arial, Helvetica, sans-serif" font-size="14" fill="#4A5568">No duplicate clones</text>
|
||||
<rect x="400" y="348" width="152" height="58" rx="8" fill="#1A2B4A" fill-opacity="0.05" stroke="#1A2B4A" stroke-width="1" stroke-opacity="0.1"/>
|
||||
<text x="416" y="370" font-family="Courier New, Courier, monospace" font-size="10" fill="#C9962A" letter-spacing="1">STEWARD-NAMED</text>
|
||||
<text x="416" y="392" font-family="Arial, Helvetica, sans-serif" font-size="14" fill="#4A5568">Someone accountable</text>
|
||||
<text x="48" y="472" font-family="Arial, Helvetica, sans-serif" font-size="20" fill="#8A9099">Seven-stage pipeline. VCAP-attested. WellSpr.ing rails.</text>
|
||||
<rect x="48" y="498" width="500" height="1" fill="#1A2B4A" opacity="0.1"/>
|
||||
<text x="48" y="536" font-family="Courier New, Courier, monospace" font-size="13" fill="#8A9099" letter-spacing="1">wellspr.ing · agentify.help · one agent per person</text>
|
||||
<rect y="625" width="1200" height="5" fill="#1A2B4A" opacity="0.4"/>
|
||||
</svg>`;
|
||||
|
||||
export function getOgPng(domain: "agentify"): Buffer {
|
||||
if (PNG_CACHE.has(domain)) return PNG_CACHE.get(domain)!;
|
||||
const png = renderSvgToPng(AGENTIFY_SVG);
|
||||
PNG_CACHE.set(domain, png);
|
||||
return png;
|
||||
}
|
||||
|
||||
setImmediate(() => {
|
||||
try { getOgPng("agentify"); console.log("[OG] agentify.help card rendered"); }
|
||||
catch(e: any) { console.error("[OG] agentify render error:", e.message); }
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue