1export let tempImageVal = {
2 "test": "img",
3 "test2": "img2",
447 "https://www.itraveljerusalem.com/article/israel-egypt-taba-border-crossing",
448 "https://www.itraveljerusalem.com/article/israeli-currency",
449 "https://www.itraveljerusalem.com/article/israel-and-pilgrimage-maps",
450 "https://www.itraveljerusalem.com/article/israel-visas-consulates",
451 "https://www.itraveljerusalem.com/article/jerusalem-day",
14 username: string;
15 bio: string;
16 profileImageUrl: string;
17};
18type ValResult = {
3export let canvasText = (async (req: Request) => {
4 const query = new URL(req.url).searchParams;
5 const { loadImage, createCanvas } = await import(
6 "https://deno.land/x/canvas/mod.ts"
7 );
117 ctx.arc(184, 352 - 240, 8, 0, 2 * Math.PI);
118 ctx.fill();
119 // image
120 const { fetchRemote } = await import(
121 "https://deno.land/x/fetchbase64@1.0.0/mod.ts"
122 );
123 const imgBase64 = await fetchRemote(query.get("img"));
124 ctx.imageSmoothingEnabled = false;
125 const img = await loadImage(imgBase64);
126 ctx.drawImage(img, 156, 174, 100, 100);
127 // headline
128 ctx.fillStyle = "#ffffff";
293 return new Response(canvas.toBuffer(), {
294 headers: {
295 "Content-Type": "image/png",
296 },
297 });
3
4export const elevenlabsTTS = async (req, res) => {
5 // https://platform.openai.com/docs/api-reference/images/create
6 // https://ale_annini-elevenlabstts.express.val.run/?args=[%22{\%22text\%22:\%22it%20beautiful\%22}%22]
7 const payload = {
3export const dighimapperMultipleMaps = (async () => {
4 const url =
5 "https://annotations.allmaps.org/maps?imageservicedomain=images.dighimapper.eu";
6 const reponse = await fetch(url);
7 const annotations = await reponse.json();
8 let imageIds = new Set();
9 let imageIdsMultipleMaps = new Set();
10 for (let annotation of annotations.items) {
11 const imageId = annotation.target.service[0]["@id"];
12 if (imageIds.has(imageId)) {
13 imageIdsMultipleMaps.add(imageId);
14 }
15 imageIds.add(imageId);
16 }
17 return [...imageIdsMultipleMaps];
18})();
40 pixelData.push(data);
41 res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0");
42 await randomGenerator(req, res); // res.set("Content-Type", "image/svg+xml");
43 // res.redirect("http://delian.io/transparent_pixel.png");
44 // return data;
3export const keepCloudClassifierWarmV4 = async () => {
4 const imgDataUrl =
5 "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
6 const response = await fetch(
7 "https://kaicathy-cloudid.hf.space/run/predict",
1import { socialImageUsageCSS } from "https://esm.town/v/tylergaw/socialImageUsageCSS";
2
3export const socialImageUsage = () => {
4 const img =
5 "https://tylergaw-socialimage.web.val.run/?bg=%23a2fa00&text=Building%20an%20Image%20Generator%20with%20Val%20Town";
6 const html = `
7<html>
8 <meta property="og:image" content="${img}">
9 <meta name="twitter:image" content="${img}">
10 <meta name="twitter:card" content="summary_large_image">
11 <title>Val Town: Image generator example usage</title>
12 <style>${socialImageUsageCSS}</style>
13 <body>
14 <h1>Image generator Example</h1>
15 <p>See <a href="https://www.val.town/v/tylergaw.socialImage">https://www.val.town/v/tylergaw.socialImage</a></p>
16
17 <ul>
18 <li><img src="https://tylergaw-socialimage.web.val.run/?bg=%23fa2500&text=Smol&color=white&w=500&h=300"></li>
19 <li><img src="https://tylergaw-socialimage.web.val.run/?bg=%23f6fa00&text=square&w=600&h=600"></li>
20 </ul>
21 </body>
1export const socialImage = async (req: Request) => {
2 const params = new URL(req.url).searchParams;
3 // Look for values form query params, set defaults
21 return new Response(canvas.toBuffer(), {
22 headers: {
23 "Content-Type": "image/png",
24 },
25 });