I am trying to get images (4 max) from the users’ computer and then convert them to raw binary content. I’m going to use the raw binary content to send to an API. I’m thinking of using Dropzone JS for the image upload (http://www.dropzonejs.com/) but I’m unsure how to manipulate the images after the user selects them without storing them directly to a collection.
I’m open to any other method of image upload as well.
The argument to the onDrop function is an array of the files uploaded. Is the data you need in there?
It sounds like you are trying to not store the files at all but in case I’m mistaken I am doing my file processing using amazon lambda scripts (with Dropzone and Slingshot to upload the files to an s3 bucket).
This thread Read/write metadata to/from a jpeg image? might have some overlap with your problem.
I am able to get the file data when the user drops a file into the UI but
how can I convert that to a base64?
You’re right, I’m not storing the image at all! I’m passing the image to an
API in base64 format.
I don’t have much experience with this specific problem but have you tried something like:
const base64file = new Buffer(files).toString('base64');
// do your thing with base64file variable...
I will definitely try that out and tell you my results. Thanks for you
…and obviously looping through files etc for the additional files if they exist.
$('.fileinput').fileinput(); and that object has the base64 string in it. I used that for my API call and it worked perfectly.
Hi @simrank where did you see the base64 in the object of $(’.fileinput’).fileinput();? How did you access it? Can you pass that straight to a meteor call?