It is my first time with Images manipulation. So i don’t have any idea about why the people uses S3 to store the images.
So. After i readed about S3 in google. I’'ll make the script to crop the image and upload to the s3 server. I plan to use this plugin for jquery: https://fengyuanchen.github.io/cropper/ (I’m using Meteor + React).
Can you explain me how i upload files in meteor? I need to upload the file in meteor server (Galaxy) to crop the image and then to S3? How i can made that work?
But. WHY i need to use a S3 or external server instead Galaxy? (For example. The same webhost of the back end with a ‘images’ folder. In Meteor ‘public\images’)
Do you have a tutorial for Lambda for crop images. Why i can made that in Galaxy?
I understand there are some issues with storing images in MongoDB.
CollectionFS used to be a popular package allowing the storage of image files in MongoDB, but I think recently it was announced that CollectionFS would no longer be maintained (I think there is a thread on here).
That being so using a package like edgee:slingshot (which is what the meteorchef article linked above uses) allows you upload images directly from the client to S3. That means your server on Galaxy does not need to handle the image at all. You simply store the link to your image in your MongoDB database.
Actually there is only one “killing” reason to use S3 - its Cost.
Many devs host Meteor apps using AWS or Digital Ocean and data transfer costs are not quite optimal for storing a huge amount of files server-side. If you host Meteor app your own, or use some kind of low-cost service(or don’t care of overpay), you may ignore S3 and any identical services entirely.
Because it’s not a “server” as you know it. You get one or more instances (servers) running at the same time. They are being recycled so they will be turned off and on constantly.
So as you can imagine: If you store your images locally they will be removed (because the server disappeared) a few minutes/hours/days later.
You can only store temporary files (for processing needs) on Galaxy.
Also it’s a good practice because: If you have 2 Galaxy instances and the client requests a file: How do you know on which server it is? S3 all handles that for your.
Only do that for data. Same as you would not write data into text files for content on your server, you store it in mongo. But for example a translations file (part of your app) would be stored on your server as part of the app.