Rails > Upload image via email - ruby-on-rails

Is there a rails plugin or gem out there that allows users to upload their image by emailing the image as an email attachment?

I would suggest you use the fetching code from here and then just use ActionMailer.receive to create an object from it/load the attachment.

You could have a look at mail which lets you create and read/parse emails.

Related

generating password protected pdfs using rails

Recently I was looking for some gem which can password protect our existing pdf files.
Basically we are fetching some invoice PDFS from aws . After fetching it from aws , we have to add password to the pdf and send it as an attachment in an email.
I tried with prawn/hexapdf/combined_pdf , but no success. Because with prawn i can not find a way to read an existing pdf. but prawn can easily password encrypt any pdf generated via prawn.
Any suggestion would be greatly appriciated.
Not really a gem, but is it possible to install and use a command line program like pdftk? I've been using it for years for similar problems with great success.

Can I use zipline gem to download from s3 without model associations with paperclip or carrierwave

I want to allow my user to download a bundle of files that are stored on s3 using the zipline gem. The files are already hosted on an s3 server but they aren't there as part of a paperclip or carrierwave attachment in my app. Will I need to create some records in my database to sort of trick zipline into thinking they are paperclip attachments, or is there a way I can send the zip file without bothering with an attachment gem? At the moment, trying to download the files with zipline doesn't throw an error message at all. It just seems to skip right over and nothing downloads.
See the part of the zipline README where an enumerator gets used to include remote files into the ZIP. It uses absolute URLs, to generate those from your S3 objects you will need to use presigned URLs (which Zipline is going to pass on to Curb):
Aws::S3::Bucket.new(your_bucket_name).object(your_key).presigned_url(:get)

How to upload and mail the same attachment file in rails 4?

I am using rails 4.
Can any one please suggest , what is the best way to upload a pdf file and the same time mail this file?
For uploading, you can use the CarrierWave library. Is pretty easy to use. And for sending an Email, you can follow this part of the Rails Tutorial Book which shows you how to setup and send emails.

How to create multipart upload to s3 (Rails)

is there any gem/ plugin or any refference to create multipart upload to s3 in Ruby on Rails?
ref : http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingRESTAPImpUpload.html
I wish to create upload very large file and need to seperate it.
I think you can try this plugin for uploading files directly to the amazon s3. I am going to use it in my the current project.
Carrierwave Direct

How should I parse a file in Ruby on Rails to store in a database?

I want to create a simple form for users to upload a file, which will be stored in a database. I also want to display all the submitted files in the database with their name and a link to download the file. Schematically, what's the best way to do this in Rails/how should I store the file in table (which fields should my table have? etc). Thanks!
i would use paperclip gem with the upload to s3 instead of file system
https://github.com/thoughtbot/paperclip
checkout the README, most of the examples are for an image, but works with non-image files as well
use paperclip to upload file, you can store images/file in your database as well as in s3 (AWS)
See below link how to use paperclip in rails with example
Here is the steps how to upload file using paperclip in rails
http://patshaughnessy.net/2009/4/30/paperclip-sample-app
for github
https://github.com/thoughtbot/paperclip
https://github.com/websymphony/Rails3-Paperclip-Uploadify

Resources