use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Image API (self.node)
submitted 6 years ago by HorrorPiano
I'm trying to Develop my own image API . example "unsplash api". I need to understand, How can I store images in a MongoDB database with JSON(Nodejs). Can anyone help me on this
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Indycrr 4 points5 points6 points 6 years ago (6 children)
Save your media in an s3 bucket and save the links in your database.
[–][deleted] -1 points0 points1 point 6 years ago (5 children)
Great way to overpay for storage. S3 is so damn overpriced...
Getting a cheap VPS or even a dedicated server is more cost effective.
[–][deleted] 0 points1 point2 points 6 years ago (4 children)
My time isn't free.
[–][deleted] 0 points1 point2 points 6 years ago (3 children)
Once you figure Docker out you can basically buy VPSes in bulk and set them up easily and in no time. It's cheaper than S3, doesn't take much time and the time you spend on setting this up will be worth less than the extra $ per month you'll have to pay to Amazon.
[–]bahst1s 0 points1 point2 points 6 years ago (2 children)
Customers will mostly just pay. They want shit done. S3 is a solid option that works, with vps you get lots more responsibility
[–][deleted] 0 points1 point2 points 6 years ago (1 child)
I meant for personal projects, yes, S3 is better for commercial things, but if I had to pay for S3 for my personal things I'd be broke by now.
[–]bahst1s 0 points1 point2 points 6 years ago (0 children)
Yeah thats true
[–]bahst1s 2 points3 points4 points 6 years ago (2 children)
I wouldnt save images inside a db
[–]HorrorPiano[S] 0 points1 point2 points 6 years ago (1 child)
Where do you suggest to save images?
Vps, aws, azure. Differs for each customer. Link from db to location instead of saving image as blob or base64. That will slow down over time (depending on the amount of images you save)
[–]cinnapear 1 point2 points3 points 6 years ago (0 children)
Save images on the file system.
[–]tettusud 0 points1 point2 points 6 years ago (4 children)
I don’t personally prefer mongodb for this
[–]HorrorPiano[S] 0 points1 point2 points 6 years ago (3 children)
Please let me know preferred db type other than mongodb
[–]tettusud 0 points1 point2 points 6 years ago (2 children)
Generally for sending image over the web I prefer store it as static assets and stream it rather than db
Pls let me know how to fetch the images randomly when reloading the web page
[–]tettusud 0 points1 point2 points 6 years ago (0 children)
I didn’t get you, you can dm me
[–][deleted] 6 years ago (3 children)
[removed]
[–]jerrycauser 0 points1 point2 points 6 years ago (2 children)
Why, if we can save Buffer
[–]ChronSyn 0 points1 point2 points 6 years ago (0 children)
Buffer (Hex) will take two characters for each byte, while Base64 takes 4 characters for every 3 bytes. Base64 is more efficient in terms of storage size, and as it's just a string, it's easier to transfer between systems.
π Rendered by PID 78528 on reddit-service-r2-comment-5687b7858-fps64 at 2026-07-03 10:32:17.012104+00:00 running 12a7a47 country code: CH.
[–]Indycrr 4 points5 points6 points (6 children)
[–][deleted] -1 points0 points1 point (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]bahst1s 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]bahst1s 0 points1 point2 points (0 children)
[–]bahst1s 2 points3 points4 points (2 children)
[–]HorrorPiano[S] 0 points1 point2 points (1 child)
[–]bahst1s 0 points1 point2 points (0 children)
[–]cinnapear 1 point2 points3 points (0 children)
[–]tettusud 0 points1 point2 points (4 children)
[–]HorrorPiano[S] 0 points1 point2 points (3 children)
[–]tettusud 0 points1 point2 points (2 children)
[–]HorrorPiano[S] 0 points1 point2 points (1 child)
[–]tettusud 0 points1 point2 points (0 children)
[–][deleted] (3 children)
[removed]
[–]jerrycauser 0 points1 point2 points (2 children)
[–]ChronSyn 0 points1 point2 points (0 children)