FarcasterSpacesSpace.tsx6 matches
295// console.log("User", uid, user);
296297const image =
298user?.pfp_url ||
299userImageUrl(uid) ||
300'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdjmD59ugIABXQB5tNl2LwAAAAASUVORK5CYII='
301302const goToProfile = (uid) => {
329<img
330className="rounded-full w-14 h-14 object-cover bg-neutral-500/10"
331src={image}
332onClick={() => setShowMenu(true)}
333/>
346<img
347className="rounded-full w-14 h-14 object-cover bg-neutral-500/10"
348src={image}
349onClick={() => setShowMenu(true)}
350/>
411}
412413function userImageUrl(address) {
414if (!address) return null
415return 'https://cdn.stamp.fyi/avatar/' + address + '?s=140'
FarcasterSpacesindex.tsx3 matches
6import { handleAnalyticsEndpoints } from './analytics.ts'
7import { embedMetadata, handleFarcasterEndpoints, name } from './farcaster.ts'
8import { handleImageEndpoints } from './image.tsx'
9import { fetchNeynarGet } from './neynar.ts'
1011const app = new Hono()
1213handleImageEndpoints(app)
14handleFarcasterEndpoints(app)
15handleAgoraEndpoints(app)
54<meta name="fc:frame" content={JSON.stringify(embedMetadata(baseUrl, path))} />
55<link rel="icon" href={baseUrl + '/icon'} />
56<meta property="og:image" content={baseUrl + '/image'} />
57</head>
58<body class="bg-white text-black dark:bg-black dark:text-white">
FarcasterSpacesimage.tsx16 matches
8import { fetchUsersById } from './neynar.ts'
910export function handleImageEndpoints(app: Hono) {
11const headers = {
12'Content-Type': 'image/png',
13'cache-control': 'public, max-age=3600', // 86400
14}
15app.get('/image', async (c) => {
16const channel = c.req.query('channel')
17if (channel) return c.body(await spaceImage(channel), 200, headers)
18return c.body(await homeImage(), 200, headers)
19})
20app.get('/icon', async (c) => {
21const rounded = !!c.req.query('rounded')
22return c.body(await iconImage(rounded), 200, headers)
23})
24}
2526export async function homeImage() {
27return await ogImage(
28<div tw="w-full h-full flex justify-start items-end text-[100px] bg-black text-white p-[50px]">
29<div tw="flex flex-col items-start">
37}
3839export async function spaceImage(channel: string) {
40const space = await fetchSpace(channel)
41if (!space) return await homeImage()
4243const users = await fetchUsersById([space.created_by, ...space.hosts, ...space.speakers].join(','))
48const speakers = users?.filter((u) => speakerFids.includes(u.fid))
4950return await ogImage(
51<div tw="w-full h-full flex justify-start items-start text-[100px] bg-black text-white p-[50px]">
52<div tw="flex flex-col items-start ">
84}
8586export async function iconImage(rounded = false) {
87const roundedClass = rounded ? 'rounded-[96px]' : ''
88return await ogImage(
89<div tw={`w-full h-full flex justify-center items-center text-[100px] bg-[#7c65c1] text-white p-[50px] ${roundedClass}`}>
90<img tw="w-[350px] h-[350px]" src={base64Icon(Mic)} />
99//////////
100101export async function ogImage(body, options = {}) {
102const svg = await satori(body, {
103width: 945,
109if (code === 'emoji') {
110const unicode = segment.codePointAt(0).toString(16).toUpperCase()
111return `data:image/svg+xml;base64,` + btoa(await loadEmoji(unicode))
112}
113return ''
145const base64 = Buffer.from(svg).toString('base64')
146// console.log('getIconDataUrl', name, svg, base64)
147return `data:image/svg+xml;base64,${base64}`
148}
149
GlancergeneratePDF.ts7 matches
1// Convert image URL to base64
2async function getImageBase64(url: string): Promise<string> {
3const res = await fetch(url);
4const buffer = await res.arrayBuffer();
5const base64 = btoa(String.fromCharCode(...new Uint8Array(buffer)));
6const contentType = res.headers.get("content-type") || "image/png";
7return `data:${contentType};base64,${base64}`;
8}
20const { applyPlugin } = await import("npm:jspdf-autotable");
2122const logoDataUrl = await getImageBase64(
23"https://www.glance.cx/hs-fs/hubfs/raw_assets/public/Glance/images/gradientLogo.png"
24);
2544let y = 20;
4546// Add image: (imageData, format, x, y, width, height)
47doc.addImage(logoDataUrl, "PNG", 20, y, 30, 10);
48y += 30;
49
untitled-4042main.js1 match
9"User-Agent":
10"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
11"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
12"Accept-Language": "en-US,en;q=0.9",
13"Accept-Encoding": "gzip, deflate, br",
slackBotExampleREADME.md1 match
7your workspace.
89
1011Read the full guide here: https://docs.val.town/integrations/slack/bot/
compare-imagesREADME.md1 match
1# compare-images
compare-imagesgenerateComparison.tsx3 matches
101a_iqa_score || a_iqa_description
102? `<dl>
103<dt><a href="https://cloudinary.com/documentation/cloudinary_ai_content_analysis_addon#image_quality_analysis">IQA</a>:</dt>
104<dd>${prettyDescriptionAndScore(a_iqa_description, a_iqa_score)}</dd>
105</dl>`
122b_iqa_score || b_iqa_description
123? `<dl>
124<dt><a href="https://cloudinary.com/documentation/cloudinary_ai_content_analysis_addon#image_quality_analysis">IQA</a>:</dt>
125<dd>${prettyDescriptionAndScore(b_iqa_description, b_iqa_score)}</dd>
126</dl>`
133</two-up>
134135<script type="module" src="https://esm.town/v/eeeps/compare-images/public/two-up-min.js"></script>
136137</body>
townie-126val-summary.ts3 matches
16SUM(cache_write_tokens) as total_cache_write_tokens,
17SUM(price) as total_price,
18SUM(num_images) as total_images
19FROM ${USAGE_TABLE}
20WHERE val_id = ? AND our_api_token = 1
54total_cache_write_tokens: 0,
55total_price: 0,
56total_images: 0
57};
58
85// Always include inference price for comparison
86inference_price: inferenceSummary.inference_price || 0,
87total_images: usageSummary.total_images,
88// Add flag to indicate inference data usage
89used_inference_data: !!inferenceSummary.inference_price,
townie-126val-detail.ts6 matches
17price?: number;
18finish_reason?: string;
19num_images?: number;
20our_api_token: boolean;
21}
31inference_price: number;
32original_price?: number;
33total_images: number;
34used_inference_data?: boolean;
35inference_price_primary?: boolean;
66<th>Cache Write</th>
67<th>Total Price</th>
68<th>Images</th>
69</tr>
70</thead>
76<td>${formatNumber(summary.total_cache_write_tokens)}</td>
77<td class="price">${formatPrice(summary.total_price)}</td>
78<td>${formatNumber(summary.total_images)}</td>
79</tr>
80</tbody>
97<th>Price</th>
98<th>Finish</th>
99<th>Images</th>
100</tr>
101</thead>
114<td class="price">${formatPrice(row.price)}</td>
115<td>${row.finish_reason || '-'}</td>
116<td>${formatNumber(row.num_images)}</td>
117</tr>
118`).join("")}