45// export const manager = {
6// getImages(type: string, count: number): Promise<string[]> {
7// return getImages(type, count);
8// },
9// };
1011export async function getImages(type: string, count: number): Promise<string[]> {
12// Query to select random rows of the specified type
13const result = await sqlite.execute(
22);
2324// console.log("images", await getImages("image", 1));
25// Extract paths from the result rows
26return result.rows.map(row => await blob.get(row.path));
7const [uploadStatus, setUploadStatus] = useState<string>("Drag and drop files here");
8const [fileUrl, setFileUrl] = useState<string | null>(null);
9const [imageType, setImageType] = useState<string>("image");
10const urlInputRef = useRef<HTMLInputElement>(null);
112930// Validate file type
31if (!["image/jpeg", "image/gif", "image/png"].includes(file.type)) {
32setUploadStatus("Only JPG, GIF, and PNG files are allowed");
33return;
36const formData = new FormData();
37formData.append("file", file);
38formData.append("type", imageType);
3940fetch("/upload", {
52});
53}
54}, [imageType]);
5556const handleDragOver = useCallback((event: React.DragEvent<HTMLDivElement>) => {
77<p>{uploadStatus}</p>
78<select
79value={imageType}
80onChange={(e) => setImageType(e.target.value)}
81style={{
82width: "100%",
85}}
86>
87<option value="image">Image</option>
88<option value="gif">GIF</option>
89<option value="stock_image">Stock Image</option>
90</select>
91<div
97}}
98>
99Drag and drop an image here
100</div>
101{fileUrl && (
146}}
147>
148View Image
149</a>
150</div>
167const formData = await request.formData();
168const file = formData.get("file") as File;
169const imageType = formData.get("type") as string;
170171if (!file) {
204await sqlite.execute(
205`INSERT INTO ${DATABASE_TABLENAME} (type, path) VALUES (?, ?)`,
206[imageType, filename],
207);
208211url: publicUrl,
212filename: filename,
213type: imageType,
214}),
215{
223<html>
224<head>
225<title>Image Upload</title>
226<style>${css}</style>
227</head>
3hi sophieee
45ok so i only edited `frontend_card`, you can see where im directly grabbing a public url i have in my blob storage aka: https://charmaine-blob_admin.web.val.run/api/public/public%2F1738957543311_Red_Happy_Valentine's_Day_PNG_Clip-Art_Image.png
67i would love to be able to make get requests to a url like that instead of hard coding them :p
blob_admin_migratedREADME.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_admin_migratedmain.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>
694const { ValTown } = await import("npm:@valtown/sdk");
695const vt = new ValTown();
696const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
697// const authorEmail = me.email;
698762763c.set("email", email);
764c.set("profile", { profileImageUrl, username });
765await next();
766};
1import { getImages } from "./image_manager";
23export default async function server(request: Request): Promise<Response> {
4const url = new URL(request.url);
5if (request.method === "GET" && url.pathname === "/image") {
6console.log("its /images");
7const imageUrls = await getImages("image", 1);
8console.log("its after getImages");
9return new Response(
10JSON.stringify({
11urls: imageUrls,
12}),
13{
23<html>
24<head>
25<title>Random Image Placement</title>
26<meta name="viewport" content="width=device-width, initial-scale=1">
27<style>
gptMemoryManagerREADME.md2 matches
5First conversation:
67
89What GPT sent do the API:
20Separate conversation somewhere in the future:
2122
2324# Setup
5First conversation:
67
89What GPT sent do the API:
20Separate conversation somewhere in the future:
2122
2324# Setup
handleMemoryApiRequestREADME.md2 matches
5First conversation:
67
89What GPT sent do the API:
20Separate conversation somewhere in the future:
2122
2324# Setup
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