Email editor with image upload feature Rails - ruby-on-rails

I am developing an app for an Organization that wants to send bulk emails (newsletters).
I need to create an interface to compose emails with image embed feature. I can use TInyMCE. But I dont know what to do to upload images and attach them in email and send them properly.
I saw MoxieManager. But Is it compatible with rails and if so how to do it.
Please help me how to solve this.
Thank you.

You could base64 encode your images and insert them into the content directly.
All you would need for this is a small custom plugin (which is not that difficult to write).

One option would be to use Paperclip or Carrierwave to dump them in an S3 bucket and just use img tags in the HTML part of the email.
The process would be
User uploads using TinyMCE
Controller attaches image files to the newsletter model whilst storing them on S3
Email send method does a substitution so that the names of images in the HTML text that TinyMCE added in the img tags are swapped out for the correct S3 urls.

Related

Add images into rails article

With Rails 5.1 and a pgsql database: I have a pretty standard Article model with :title and :description. Users can make your typical text-only articles.
What if users wanted to embed a gif or image into the post, like between paragraphs? I see a lot of this type of format on other website blogs and I am not sure how to achieve this with Rails.
Note also I am using simple_format(article) to display, so any formatting done on creation should hold.
Any ideas?
There is actually quite a bit of work involved with this:
If you need to allow your users to upload images from their
computer, you will need to get your head around the Paperclip
gem (or similar). This will store the image on the server.
You'll want to determine how big can images be, what to name the
images once uploaded and what file formats are permitted to prevent
users uploading all sorts of files.
Next on the front-end, you can either use a rich text editor (eg. CKEditor or TinyMCE are the main ones) to embed the
IMG tag(s) into your Article text, or structure that layout yourself
(eg. "Always display an image before/after the article text"). Do
your images need captions? Do they need to be clickable?
Lastly, in your Show template, don't forget to use Rail's image tag helpers rather than your standard IMG tags. This enables you
to easily reference the images on the server without getting lost in
the asset pipeline.
There are some videos out there showing how all this is done, eg. https://www.youtube.com/watch?v=Z5W-Y3aROVE. Good luck!

configure paperclip to generate styles when they are requested

I need a user to upload an original file and process that into a thumbnail (paperclip's got this - check).
Then I would like to be able to retrieve different styles for that attachment, but I do not need to store those different styles on disk anywhere. I would prefer they are generated during the request.
The reason for that is that these styles are single-use. So, paperclip becomes a glorified one-time-use image resiszer. I'd prefer not to incur the S3 cost if I don't have to.
Wondering if there'a way to do this out of the box. Or, maybe carrierwave supports something like this?
Thanks!
I'm pretty sure that the Refile library supports it. Refile is basically a modern version of the Carrierwave, written by the same author.
You can read more about the on-the-fly processing here:
https://github.com/refile/refile#processing

Is there a way to save remote urls as they are with CarrierWave?

Is there a way to configure CarrierWave to not download remote images but save the urls as they are?
This is probably a strange question, but there is a case that we do not care the real size of the image if it comes from somewhere outside our website.
Update:
Why not just use a string field to store the url?
Because not all images come from remote urls, some of them are uploaded by users.
I'm just curious if there is a way to configure CarrierWave like that.
Why use carrierwave so? Just use a string field to store the url.

rails form to pdf and save to amazon s3

I have a form for users to fill out about specific attributes first_name,last_name etc.
I need to generate a pdf from this form and also send an email with the pdf of the form as an attachment.
My approach was to save it to Amazon S3 and somehow attach it in the create method in my controller.
Any input would be greatly appreciated!
You will probably need to use something like the prawn gem https://github.com/prawnpdf/prawn . This will allow you to generate a PDF file from within your application. Your question is somewhat vague though, but you should be able to generate the PDF fairly easily using prawn

Parse word docs heroku/s3

I want to implement a functionality that needs to parse word docs, which will uploaded by user and stored on amazon S3. The application will be on heroku. I tried catdoc but it doesn't parse urls. Can anyone suggest tool that can be used on heroku to parse word documents?
UPDATE
I want to scan an uploaded ms-word(.doc) has particular words and tag them accordingly.
If you're just wanting to upload the word document you could take a look at something like the paperclip gem.
This would allow you to save the file on amazon S3 and simply download it, but you could also extend paperclip and run post-processing on the file. This is slightly more complicated.
Like willglynn says, it would be good to know what parsing you need to do, exactly?

Resources