textToImagePlaygroundmain.tsx9 matches
8<meta charset="UTF-8">
9<meta name="viewport" content="width=device-width, initial-scale=1.0">
10<title>Image Generator</title>
11<style>
12${formStyles}
15<body>
16<header>
17<h2>Text to Image Playground</h2>
18<a target="blank" href="https://fal.ai">fal.ai</a>
19</header>
24</select> -->
25
26<form id="imageForm">
27<label for="model">Model:</label>
28<select id="model" name="model">
39</div>
40<div class="buttons">
41<button type="submit">Generate Image</button>
42<button type="button" id="resetButton">Reset</button>
43</div>
62const type = this.value;
63if (type === 'regular') {
64document.getElementById('imageForm').style.display = 'block';
65document.getElementById('realtimeForm').style.display = 'none';
66} else {
67document.getElementById('imageForm').style.display = 'none';
68document.getElementById('realtimeForm').style.display = 'block';
69}
73window.addEventListener('DOMContentLoaded', (event) => {
74document.getElementById('generationType').value = 'regular';
75document.getElementById('imageForm').style.display = 'block';
76document.getElementById('realtimeForm').style.display = 'none';
77});
89status: 200,
90});
91} else if (req.method === 'POST' && url.pathname === '/generate-image') {
92return await falProxyRequest(req, {
93baseUrl: 'https://fal.ai/api/fast/image-generation'
94// apiKey: 'your-fal-api-key' // You might want to use Deno.env.get() for this
95});
cerebras_codermain.tsx1 match
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second β powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169
codemirrorTsREADME.md1 match
234
56
23```
2425## Images
2627To send an image to ChatGPT, the easiest way is by converting it to a
28data URL, which is easiest to do with [@stevekrouse/fileToDataURL](https://www.val.town/v/stevekrouse/fileToDataURL).
2930```ts title="Image Example" val
31import { fileToDataURL } from "https://esm.town/v/stevekrouse/fileToDataURL";
3244role: "user",
45content: [{
46type: "image_url",
47image_url: {
48url: dataURL,
49},
linkinbio_25_2_5main.tsx2 matches
8name: "Alex Rivera",
9bio: "Designer & Developer exploring digital minimalism",
10profileImage: "bi-person-circle", // Bootstrap icon
11links: [
12{ title: "Portfolio", url: "#", icon: "bi-grid-3x3-gap" },
49alignItems: 'center'
50}}>
51<i className={`bi ${profileData.profileImage}`}></i>
52</div>
53<h1 style={{
6const [user, setUser] = useState(null);
7const [posts, setPosts] = useState([]);
8const [selectedImage, setSelectedImage] = useState(null);
9const [imagePreview, setImagePreview] = useState(null);
10const [postCaption, setPostCaption] = useState("");
1120}, []);
2122const handleImageUpload = (e) => {
23const file = e.target.files[0];
24if (file) {
25setSelectedImage(file);
26const reader = new FileReader();
27reader.onloadend = () => {
28setImagePreview(reader.result);
29};
30reader.readAsDataURL(file);
35e.preventDefault();
36const formData = new FormData();
37formData.append("image", selectedImage);
38formData.append("caption", postCaption);
394647// Reset form
48setSelectedImage(null);
49setImagePreview(null);
50setPostCaption("");
51};
89<input
90type="file"
91accept="image/*"
92onChange={handleImageUpload}
93/>
94{imagePreview && (
95<img
96src={imagePreview}
97alt="Preview"
98className="image-preview"
99/>
100)}
104placeholder="Write a caption..."
105/>
106<button type="submit" disabled={!selectedImage}>
107Post
108</button>
114<div key={post.id} className="photo-card">
115<img
116src={post.image_url}
117alt={post.caption || "Post"}
118/>
185id INTEGER PRIMARY KEY AUTOINCREMENT,
186user_id INTEGER NOT NULL,
187image_url TEXT NOT NULL,
188caption TEXT,
189likes INTEGER DEFAULT 0,
195const url = new URL(request.url);
196197// Image upload handling
198if (url.pathname === "/api/posts" && request.method === "POST") {
199const formData = await request.formData();
200const imageFile = formData.get("image");
201const caption = formData.get("caption");
202203// Store image in blob storage
204const imageKey = `${KEY}_post_${Date.now()}`;
205const imageUrl = await blob.set(imageKey, imageFile);
206207// Insert post record
208const result = await sqlite.execute(
209`INSERT INTO ${KEY}_posts (user_id, image_url, caption) VALUES (1, ?, ?)`,
210[imageUrl, caption],
211);
212213return Response.json({
214id: result.lastInsertRowid,
215image_url: imageUrl,
216caption,
217author: "User",
308}
309310.image-preview {
311max-width: 100%;
312max-height: 300px;
emailToDiscordemailHandler5 matches
3import { sendWithRateLimit } from "https://esm.town/v/wilt/emailToDiscord/discordClient";
4import { requestAsObject } from "https://esm.town/v/wilt/serializeRequest";
5import { imageSize } from "npm:image-size";
67export interface IEmailHandlerProps {
30}
3132interface IImage {
33url: string;
34height?: number;
41url?: string;
42footer?: { text: string };
43image?: IImage;
44video?: IImage;
45provider?: { name?: string; url?: string };
46}
125126const fileHooks: RequestInit[] = await Promise.all(sizedAttachments.map(async (file) => {
127const embed: IEmbed = { image: { url: "attachment://" + file.name } };
128const boundary = "--boundary";
129const buf = await file.arrayBuffer();
adroitIvoryEchidnamain.tsx5 matches
33interface Recommendation {
34description: string;
35imageUrl: string;
36latitude: number;
37longitude: number;
350>
351<img
352src={rec.imageUrl}
353alt={`Destination ${index + 1}`}
354style={{
482}
483
484const recommendationsWithImages = await Promise.all(
485parsedRecommendations.map(async (rec: any) => ({
486...rec,
487imageUrl: `https://maxm-imggenurl.web.val.run/${encodeURIComponent(rec.description)}`
488}))
489);
490
491return new Response(JSON.stringify({
492recommendations: recommendationsWithImages
493}), {
494headers: { 'Content-Type': 'application/json' }
cerebras_codermain.tsx1 match
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second β powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169
cerebras_codermain.tsx1 match
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second β powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169