Thinking of more full-stack Cloudflare teething issues. Turns out its really hard to connect to d1 remotely? but how does drizzle do this with their d1 client I wonder? .

displaying r2 image objects as urls the hard way:

const APP_BUCKET = Astro.locals.runtime.env.APP_BUCKET;

const image = await APP_BUCKET.get("local-image", {});

const imageBuffer = await image?.arrayBuffer();

const imageBase64 = btoa(String.fromCharCode( Uint8Array(imageBuffer)));

const imageUrl = `data:image/png;base64,${imageBase64}`;

Display images from r2 the easy way.

note: link your custom domain is the preferred method when going to prod as you can use existing Cloudflare caching -

transform images with a Cloudflare images and their URL API:

note: you must have a domain to be able to do this, once enable it exposes a sub path cdn-cgi on your domain a.k.a zone e.g,quality=75/