I am using next.js and managing the session with node-appwrite. I have uploaded an image to appwrite storage. The fileId is stored in the database. Now I would like to show the user the image with the fileId.
This is my code.
"use server";
import { createAdminClient } from "@/lib/server/appwrite";
export async function getFilePreview(fileId: string) {
const bucketId = "66a4af5b000a38b0dd62";
const { storage } = await createAdminClient();
const result = await storage.getFilePreview(bucketId, fileId);
const blob = new Blob([result], { type: "image/webp" }); // Adjust the MIME type if necessary
return URL.createObjectURL(blob);
}
How do I use the blob in next.js <Image /> tag
Recommended threads
- AppwriteException: CERTIFICATE_VERIFY_F...
getting this error while using Cloud : "Session invalid during cache load, clearing cached data: AppwriteException: , HandshakeException: Handshake error in cl...
- Re-connect site to domain verification f...
I have mistakenly deleted appwrite site without removing domain. Now I created same site and want to re-connect my domain. It gives this error while verify. How...
- Console not loading - ERR_NAME_NOT_RESOL...
Hi everyone/team, is anyone else experiencing DNS issues accessing the Appwrite Console? I cannot load my project dashboard. My browser console is returning: Fa...