DylanDevD
Convex Community16mo ago
4 replies
DylanDev

Help with loading images from image id in a table and image sitting in the Files

I'm making a next.js/react app using typescript.

I have a query to get every level:
import { v } from "convex/values";

import { mutation, query } from "./_generated/server";
import { Doc, Id } from "./_generated/dataModel";

export const get = query({
    handler: async (ctx) => {
        const levels = await ctx.db.query("levels").collect();

        return levels;
    }
});


Then I want to set an image to have the src of this image sitting in the files:
"use client";

import { api } from "@/convex/_generated/api";
import { useQuery } from "convex/react";
import Image from "next/image";

const GameModesPage = () => {
    return ( 
        <div>
            <Image src={imageSrcUrl} />
        </div>
    );
}
 
export default GameModesPage;


Can anyone help me do this? I am a little confused on the documentation
Screenshot_2024-10-05_at_2.53.39_PM.png
Screenshot_2024-10-05_at_2.53.32_PM.png
Was this page helpful?