Skip to content

Connecting Product Image With the Product data #7677

Answered by minecrawler
surjeet88 asked this question in Q&A
Discussion options

You must be logged in to vote

You can store the file's ID in the database. For example I store additional user data in the DB, and I connect it to Authentication and Storage using the IDs. When a user logs in I search for the Authentication ID in the user DB, get the avatar field and then ask Storage for a file in a bucket with a certain ID in order to get the link to the avatar file in order to display it.

Something like this:

const account = account.get();
const userDataFromDB = databases.listDocuments(CDBApp, CColUser, [Query.equal('id', account!.$id)]).document[0];
const avatarUrl = storage.getFileView(CBucketProfileId, userDataFromDB!.avatarId).href;

In your case, you'd store the product's info along with the fil…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by surjeet88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants