Suggestion to Improve Image Storage Implementation #26
ishaanxgupta
started this conversation in
Ideas
Replies: 1 comment
-
Hi @pradeeban, Just following up on my suggestion to store images in MongoDB as Base64 or binary for better scalability and security. Let me know if this is something worth exploring—I’d be happy to work on it and ensure backward compatibility. Looking forward to your feedback! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @pradeeban
I’ve been reviewing the project, and I noticed that the current implementation stores uploaded images in the static folder of the project. While this approach works, I wanted to suggest an alternative that might offer better scalability and flexibility.
Proposal: Storing Images as Base64 Strings or Binary in MongoDB
Instead of saving images directly in the static folder, we could encode the image files as Base64 strings or store them in MongoDB as binary data using the GridFS feature. Here’s why this might be beneficial:
Scalability:
Storing images in the database keeps them decoupled from the server's file system, making it easier to scale the application across multiple instances.
Security:
By storing images as binary or Base64 strings, access can be managed through the database, ensuring only authenticated users can retrieve or modify them.
Portability:
Backing up and migrating data becomes simpler, as all image-related data is contained within the database rather than spread across the file system.
Clean Static Folder:
This approach avoids cluttering the static folder with user-uploaded files, keeping it dedicated to application assets (CSS, JS, etc.).
If this sounds like a feature worth exploring, I’d be happy to work on it and contribute the code. I can ensure backward compatibility, so existing files remain unaffected, and we can migrate to the new system gradually if needed.
Please let me know your thoughts, and if approved, I’d be glad to start working on a pull request.
Looking forward to your feedback!
Beta Was this translation helpful? Give feedback.
All reactions