createFileInputAppmain.tsx3 matches
39<div class="container">
40<div class="file-group" id="original">
41<input type="file" id="fileInput" multiple accept="image/*">
42<button id="addButton">+</button>
43</div>
56group.className = 'file-group';
57
58// Create image preview if it's an image file
59if (file.type.startsWith('image/')) {
60const preview = document.createElement('img');
61preview.className = 'preview';
26
27const file = e.dataTransfer.files[0];
28if (!file || !file.type.startsWith('image/png')) {
29setError("Please drop a PNG image file");
30setLoading(false);
31return;
3334if (file.size > 5 * 1024 * 1024) { // 5MB limit
35setError("Image is too large. Please use an image under 5MB.");
36setLoading(false);
37return;
48// Get metadata from server
49const formData = new FormData();
50formData.append('image', file);
51
52const response = await fetch('?process=true', {
84<div className="dropzone-content">
85<span className="icon">📄</span>
86<p>{loading ? 'Processing...' : 'Drag and drop a PNG image here'}</p>
87<small>Maximum file size: 5MB</small>
88</div>
131132export default async function server(req: Request): Promise<Response> {
133// Handle image processing
134if (req.method === 'POST' && new URL(req.url).searchParams.get('process')) {
135try {
136const formData = await req.formData();
137const imageFile = formData.get('image') as File;
138
139if (!imageFile) {
140return new Response('No image provided', { status: 400 });
141}
142143if (!imageFile.type.startsWith('image/png')) {
144return new Response('Only PNG images are supported', { status: 400 });
145}
146147const arrayBuffer = await imageFile.arrayBuffer();
148const bytes = new Uint8Array(arrayBuffer);
149162height,
163fileSize: bytes.length,
164type: imageFile.type,
165name: imageFile.name
166}), {
167headers: {
171172} catch (error) {
173return new Response(`Failed to process image: ${error.message}`, { status: 500 });
174}
175}
squishyformmain.tsx4 matches
480<meta charset="UTF-8">
481<meta name="viewport" content="width=device-width, initial-scale=1.0">
482<link rel="icon" type="image/png" href="https://labspace.ai/ls2-circle.png" />
483<title>Squishy Form Demo</title>
484<meta property="og:title" content="Squishy Form Experiment" />
485<meta property="og:description" content="A form that can parse free-form text, JSON, and table inputs" />
486<meta property="og:image" content="https://yawnxyz-og.web.val.run/img?link=https://yawnxyz-squishyform.web.val.run&title=Squishy+Form+Demo&subtitle=A+form+that+can+parse+free-form+text,+JSON,+and+table+inputs" />
487<meta property="og:url" content="https://yawnxyz-squishyform.web.val.run/" />
488<meta property="og:type" content="website" />
489<meta name="twitter:card" content="summary_large_image" />
490<meta name="twitter:title" content="Squishy Form Experiment" />
491<meta name="twitter:description" content="A form that can parse free-form text, JSON, and table inputs" />
492<meta name="twitter:image" content="https://yawnxyz-og.web.val.run/img?link=https://yawnxyz-squishyform.web.val.run&title=Squishy+Form+Demo&subtitle=A+form+that+can+parse+free-form+text,+JSON,+and+table+inputs" />
493<script src="https://cdn.tailwindcss.com"></script>
494<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.30.1/min/vs/loader.js"></script>
qrCodeWebhookmain.tsx1 match
165return new Response(svg, {
166headers: {
167"Content-Type": "image/svg+xml",
168},
169});
38<meta property="og:description" content="A tool to help delete bacteria before sepsis deletes us. Part of the ms2 project collecting data on bacteria and mobile genetic elements over time.">
39<meta name="twitter:description" content="A tool to help delete bacteria before sepsis deletes us. Part of the ms2 project collecting data on bacteria and mobile genetic elements over time.">
40<link rel="icon" href="https://f2.phage.directory/blogalog/phageray.png" type="image/png">
41<meta property="og:image" content="https://f2.phage.directory/blogalog/sepsis.png">
42<meta name="twitter:image" content="https://f2.phage.directory/blogalog/sepsis.png">
43<script src="https://cdn.tailwindcss.com" > </script>
44<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.6.0/processing.min.js"></script>
worthyCopperPigeonmain.tsx1 match
5let logs: any[] = [];
6php.addEventListener("output", (event: any) => logs.push(...event.detail));
7const script = "<?php header('Content-Type: image/jpeg'); echo \"Hello, world!\"; ";
8const exitCode = await php.run(script);
9console.log({ script, exitCode, logs, foo });
5let logs: any[] = [];
6php.addEventListener("output", (event: any) => logs.push(...event.detail));
7const script = "<?php echo \"Hello, world!\"; header('Content-Type: image/jpeg');";
8const exitCode = await php.run(script);
9return Response.json({ script, exitCode, logs });
blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67## Installation
musicFromPromptmain.tsx14 matches
6const [prompt, setPrompt] = useState("");
7const [isLoading, setIsLoading] = useState(false);
8const [imageUrl, setImageUrl] = useState("");
9const [error, setError] = useState("");
1011async function generateImage() {
12setIsLoading(true);
13setError("");
15const encodedPrompt = encodeURIComponent(prompt);
16const url = `https://maxm-imggenurl.web.val.run/${encodedPrompt}`;
17setImageUrl(url);
18} catch (err) {
19setError("Failed to generate image. Please try again.");
20} finally {
21setIsLoading(false);
25return (
26<div className="container">
27<h1>🎨 AI Image Generator</h1>
28<div className="input-group">
29<input
31value={prompt}
32onChange={(e) => setPrompt(e.target.value)}
33placeholder="Describe the image you want to see..."
34disabled={isLoading}
35/>
36<button onClick={generateImage} disabled={isLoading || !prompt}>
37{isLoading ? "Generating..." : "Generate Image"}
38</button>
39</div>
40{error && <div className="error">{error}</div>}
41{imageUrl && (
42<div className="image-container">
43<img src={imageUrl} alt={prompt} />
44</div>
45)}
64<html>
65<head>
66<title>AI Image Generator</title>
67<meta name="viewport" content="width=device-width, initial-scale=1">
68<style>${css}</style>
121}
122123.image-container {
124margin: 2rem 0;
125}
126127.image-container img {
128max-width: 100%;
129height: auto;
modifyImageREADME.md2 matches
1Code from https://deno.com/blog/build-image-resizing-api
23Useful for compressing an image before sending to chatgpt4v, for example