Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor Amazon S3 image upload with thumbnails

I'm using Meteor and would like to create a form with an image upload field that saves the uploaded file to an Amazon S3 bucket in its original size as well as multiple thumbnails sizes defined (passed) via the code.

So far I'm using the lepozepo:s3 package which works great but doesn't seem to allow options for generating additional thumbnails.

Given I can upload the original files onto S3 I'm considering looking into a service on Amazon that can generate the desired thumbnails and then notify my Meteor app. But I'm not sure how to achieve that.

Can anyone point me in the right direction or share some insight into the best approach for this?

PS: I want to avoid using Filepicker.io is possible.

like image 240
onepixelsolid Avatar asked Oct 19 '22 22:10

onepixelsolid


2 Answers

Seems I was following the wrong path. CollectionFS has everything I need and more. I now have this working with plenty of scope to do more later. This is one brilliant collection of packages with clear guides on respective Github pages.

Here are the packages I ended up usings:

  • cfs:standard-packages - base
  • cfs:gridfs - required for some reason, not sure why
  • cfs:graphicsmagick - thumbnailing/cropping
  • cfs:s3 - S3 upload

Code sample →

like image 123
onepixelsolid Avatar answered Oct 22 '22 20:10

onepixelsolid


CollectionFS is now deprecated, but there are other options:

  • Only upload, without S3 integration*: https://github.com/tomitrescak/meteor-uploads

Use the jQuery-File-Upload (which is great), it generates thumbs, has size and format validation, etc. Using basically these two packages together:

https://atmospherejs.com/tomi/upload-jquery

https://atmospherejs.com/tomi/upload-server

You can use other package for S3 integration.

Like: https://github.com/peerlibrary/meteor-aws-sdk/


  • Upload + Integration with S3: https://github.com/Lepozepo/S3

Good, but if you need to generate thumbs for example you will need to integrate with other package or do it yourself. I not tested, but I got this suggestion: https://github.com/jamgold/cropuploader


  • Upload only, but with examples of how to generate thumbs or integrate with S3 / DropBox / GridFS /: https://github.com/VeliovGroup/Meteor-Files/

Rich documentation and does well which proposes: Upload images.


Use that adapt best to your needs.

like image 35
Liko Avatar answered Oct 22 '22 21:10

Liko