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
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...