patientGreenSkinkREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Versions 0-17 of this val were done with Hono and server-rendering.
patientGreenSkinkmain.tsx5 matches
440{profile && (
441<div className="flex items-center space-x-4">
442<img src={profile.profileImageUrl} alt="Profile" className="w-8 h-8 rounded-full" />
443<span>{profile.username}</span>
444<a href="/auth/logout" className="text-blue-400 hover:text-blue-300">Logout</a>
583alt="Blob content"
584className="max-w-full h-auto"
585onError={() => console.error("Error loading image")}
586/>
587</div>
635<li>Create public shareable links for blobs</li>
636<li>View and manage public folder</li>
637<li>Preview images directly in the interface</li>
638</ul>
639</div>
693const { ValTown } = await import("npm:@valtown/sdk");
694const vt = new ValTown();
695const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
696// const authorEmail = me.email;
697761762c.set("email", email);
763c.set("profile", { profileImageUrl, username });
764await next();
765};
1const imageCyclerPage = (text: string) =>
2`<!DOCTYPE html>
3<html>
4<head>
5<title>Image Cycler</title>
6<style>
7body {
111112// Return the fetched content with the original content type
113return new Response(imageCyclerPage(text), {
114headers: {
115"Content-Type": "text/html",
glifInventorymain.tsx10 matches
6const KEY = "glifInventory";
7const INVENTORY_TABLE = `${KEY}_inventory_${SCHEMA_VERSION}`;
8const DEFAULT_IMAGE_URL = "https://res.cloudinary.com/dzkwltgyd/image/upload/v1733165766/image-input-block-production/apjbm5nfc6yoevwnisxh.jpg";
910// Inventory Database Initialization
16item_name TEXT NOT NULL,
17item_type TEXT NOT NULL,
18image_url TEXT NOT NULL,
19description TEXT,
20quantity INTEGER NOT NULL DEFAULT 1,
51.min(1, "Item name is required")
52.max(100, "Item name must be 100 characters or less"),
53image: z.string()
54.url("Valid image URL is required")
55.max(500, "Image URL must be 500 characters or less")
56.optional(),
57type: z.string()
111id: row.id,
112name: row.item_name,
113image: row.image_url,
114type: row.item_type,
115description: row.description,
129await sqlite.execute(
130`INSERT INTO ${INVENTORY_TABLE} (
131id, address, item_name, item_type, image_url,
132description, quantity, weight, rarity, durability
133) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
140item.name,
141item.type,
142item.image || DEFAULT_IMAGE_URL,
143item.description || null,
144item.quantity || 1,
393"item": {
394"name": "Magic Sword",
395"image": "https://example.com/sword.png",
396"type": "tool",
397"description": "A powerful magical sword",
400}
401}'</code></pre>
402<p>Note: The "image" field is optional. If not provided, a default image will be used.</p>
403404<h3 class="route">POST /remove</h3>
blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Versions 0-17 of this val were done with Hono and server-rendering.
blob_adminmain.tsx5 matches
440{profile && (
441<div className="flex items-center space-x-4">
442<img src={profile.profileImageUrl} alt="Profile" className="w-8 h-8 rounded-full" />
443<span>{profile.username}</span>
444<a href="/auth/logout" className="text-blue-400 hover:text-blue-300">Logout</a>
583alt="Blob content"
584className="max-w-full h-auto"
585onError={() => console.error("Error loading image")}
586/>
587</div>
635<li>Create public shareable links for blobs</li>
636<li>View and manage public folder</li>
637<li>Preview images directly in the interface</li>
638</ul>
639</div>
693const { ValTown } = await import("npm:@valtown/sdk");
694const vt = new ValTown();
695const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
696// const authorEmail = me.email;
697761762c.set("email", email);
763c.set("profile", { profileImageUrl, username });
764await next();
765};
blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Versions 0-17 of this val were done with Hono and server-rendering.
blob_adminmain.tsx5 matches
440{profile && (
441<div className="flex items-center space-x-4">
442<img src={profile.profileImageUrl} alt="Profile" className="w-8 h-8 rounded-full" />
443<span>{profile.username}</span>
444<a href="/auth/logout" className="text-blue-400 hover:text-blue-300">Logout</a>
583alt="Blob content"
584className="max-w-full h-auto"
585onError={() => console.error("Error loading image")}
586/>
587</div>
635<li>Create public shareable links for blobs</li>
636<li>View and manage public folder</li>
637<li>Preview images directly in the interface</li>
638</ul>
639</div>
693const { ValTown } = await import("npm:@valtown/sdk");
694const vt = new ValTown();
695const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
696// const authorEmail = me.email;
697761762c.set("email", email);
763c.set("profile", { profileImageUrl, username });
764await next();
765};
1920const formData = new FormData();
21formData.append('image', file);
2223try {
44textAlign: 'center'
45}}>
46<h1>🖼️ Image to PDF Converter</h1>
47<input
48type="file"
49accept="image/jpeg,image/png,image/gif"
50onChange={handleFileChange}
51/>
104if (request.method === 'POST') {
105const formData = await request.formData();
106const imageFile = formData.get('image') as File;
107108if (!imageFile) {
109return new Response('No image uploaded', { status: 400 });
110}
111112const arrayBuffer = await imageFile.arrayBuffer();
113const pdfDoc = await PDFDocument.create();
114const page = pdfDoc.addPage();
122);
123124page.drawImage(img, {
125x: (pageWidth - img.width * imgScale) / 2,
126y: (pageHeight - img.height * imgScale) / 2,
142<html>
143<head>
144<title>Image to PDF Converter</title>
145<script src="https://esm.town/v/std/catch"></script>
146</head>
popularAquamarineDormousemain.tsx29 matches
1import { createCanvas, loadImage } from "https://deno.land/x/canvas/mod.ts";
2import { BLOB_PREFIX, PlateDetails, POST_PREFIX } from "https://esm.town/v/adnan/findPlates";
3import { blueskyPostWithImage } from "https://esm.town/v/dupontgu/heavenlyOrangeMarmoset";
4import { Counter } from "https://esm.town/v/dupontgu/persistentCounter";
5import { blob } from "https://esm.town/v/std/blob";
67interface Image {
8url: string;
9// text locations within image, Vec3: [x, y, rotation]
10slammer_txt_loc: number[];
11slammed_txt_loc: number[];
14}
1516// async function overlayTextOnImage(imageDef: Image): Promise<Uint8Array> {
17// console.log(imageDef);
18// const image = await loadImage(imageDef);
1920// // Define the desired aspect ratio (16:9)
2223// // Calculate the new dimensions for the canvas
24// let newWidth = image.width();
25// let newHeight = image.height();
2627// if (newWidth / newHeight > targetAspectRatio) {
28// // Image is wider than 16:9, adjust width
29// newWidth = newHeight * targetAspectRatio;
30// } else {
31// // Image is taller than 16:9, adjust height
32// newHeight = newWidth / targetAspectRatio;
33// }
3738// // Calculate the cropping offset
39// const offsetX = (image.width() - newWidth) / 2;
40// const offsetY = (image.height() - newHeight) / 2;
4142// // Draw the image with cropping
43// ctx.drawImage(
44// image,
45// offsetX,
46// offsetY,
53// );
5455// return canvas.toBuffer("image/png");
56// }
5758async function overlayTextOnImage(imageDef: Image): Promise<Uint8Array> {
59const image = await loadImage(imageDef);
6061// Original image dimensions
62const originalWidth = 541;
63const originalHeight = 132;
74ctx.fillRect(0, 0, canvasSize, canvasSize);
7576// Center the original image on the canvas
77const xOffset = (canvasSize - originalWidth) / 2;
78const yOffset = (canvasSize - originalHeight) / 2;
79ctx.drawImage(image, xOffset, yOffset, originalWidth, originalHeight);
8081return canvas.toBuffer("image/png");
82}
8392const postCounter = new Counter("PLATE_post_counter");
93const count = await postCounter.get();
94const image = plateDetails.imageUrl;
9596const adjustedHeadline = plateDetails.title;
101console.log(plateDetails);
102console.log(statusText);
103const altText = `\n A number plate with the digits ${plateDetails.title}.\n\n image source: ${plateDetails.imageUrl}`;
104await blob.delete(inputs[0].key);
105await blob.setJSON(POST_PREFIX + plateDetails.url);
106await postCounter.increment();
107108const modifiedImageBuffer = await overlayTextOnImage(image);
109110await blueskyPostWithImage(statusText, modifiedImageBuffer, altText);
111return new Response(modifiedImageBuffer, {
112headers: {
113"Content-Type": "image/png",
114},
115});