Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to save the image in DB #136

Open
skydread1 opened this issue Apr 12, 2023 · 2 comments
Open

There is no way to save the image in DB #136

skydread1 opened this issue Apr 12, 2023 · 2 comments
Assignees

Comments

@skydread1
Copy link
Owner

Problem

There is no way to save image in DB (user profile pic, posts beside images).

Suggestion

Maybe we can use pantomime to convert the files in BLOB before storing in Datalevin DB.

This should happen only server side.

@skydread1 skydread1 self-assigned this Apr 12, 2023
@robertluo
Copy link
Collaborator

Saving blob binary files into database is a common architecture error:

  1. databases are not designed for arbitrary binary files, while filesystems are.
  2. databases are good for storing structured data, such as meta data of files.

We notice that "files" are just structured data with binary contents, store them in database let it can be queried, while put the binary contents into a blob store -- normally just file systems.

  • most time, filename (which is an ID for file system) will be an automatically generated string.

@skydread1
Copy link
Owner Author

skydread1 commented Apr 12, 2023

Ok noted!

So, I think the steps could be:

  • From url of image given by user, fetch it and convert to blob using pantomime (for instance)
  • Store the blob in a blob store (aws s3 maybe)
  • Store the blob name in datalevin db
  • When needed, use the blob name taken from db to access the blob in the blob store (or use Cloudfront to get a url directly)
  • Display the blob in the web page from cloudfront url or convert to png if accessed from s3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants