meteorjs image upload / conversion

被刻印的时光 ゝ 提交于 2020-01-23 08:44:31

问题


I need to upload a file to meteor, do some image manipulation on it (image conversion if necessary, generate thumbnail from image ) and then store it in an external image storage server (s3). This should be as fast as possible. Do you have any recommendations for a nodejs image processing library ? also how i can upload a file to meteorjs ?

Thanks


回答1:


I ended up with the following solution:

1) meteor server side route for a custom upload url

__meteor_bootstrap__.app.stack.splice (0, 0, {
    route: '/upload',
    handle: function (req,res, next) {
        //handle upload
    }.future ()
});

2) use formidable nodejs module inside the function for file upload




回答2:


Easiest solution I have found is using FilePicker.io. It's extremely easy to integrate into your Meteor App and plugs directly into S3.




回答3:


In my startup (hausor.com) I use https://github.com/CollectionFS/Meteor-CollectionFS and with additional plugins it supports amazon S3 file upload and image scaling/cropping.




回答4:


I don't think Meteor has any support for uploads; perhaps something is planned in the future. In the meantime, I'd either (assuming you can reading the file with a FileReader or something):

a) insert the file into the mongo and then delete it when it is saved to S3

b) save it up to S3 from the client (not sure if there's a "safe" way to do this.. ie without giving away your credentials, but it could be worth exploring).

c) [if you can't use a FileReader] use an iframe or something to POST to an external server you can control that does handle uploads and then communicate with it from the meteor server.




回答5:


Kindly check one of my answer here : File upload and download using meteor

I am using busboy for file upload and just use fs = Npm.require("fs") for file writing: Just put these inside busboy:, the save to is the path where you uploaded, simple us APACHE or file hosting and use other port on it..

file.pipe(fs.createWriteStream(saveTo))



来源:https://stackoverflow.com/questions/11689755/meteorjs-image-upload-conversion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!