Here's another alternative for you---- check this out: https://github.com/comfy/comfortable-mexican-sofa
It is a fully-fledged CMS engine that actually has a file uploader built in (I think you can upload a file and then DRAG the file reference from the "Upload files" panel on the right into the content you are editing). This is a bit of a departure from what you originally started with, but consider that you would be leveraging a lot of open source code that is already working. In general I would classify what you are trying to build as a pretty expensive thing to build. Something like comfortable-mexican-sofa would allow you to leverage a very similar CMS interface and build on top of work that is already in place. -Jason On Aug 25, 2014, at 3:33 PM, Jason Fleetwood-Boldt <[email protected]> wrote: > > mmmm.... I see your problem. You want an "built-in" image uploader? > > That's actually pretty hard, but with a bit of work you will be able to pull > that off. > > You have two basic strategies: > > 1) Make the user upload the image file somewhere else (like amazon S3 bucket) > using their own client (like an FTP client), then copy & paste the URL into > your WYSIWYG editor (wrapped inside an image tag) ---- most editors let you > do that easily. > > 2) provide an interface for the user to upload the image from their computer > to your website (I see now why you were going down the paperclip route). Then > make some kind of interface that allows them to drop a string-style reference > to the image into the WYSIWYG editor. In the app I'm currently working on, we > have a special macro inside the editor so you use something like this: > > [IMAGE:123] > > When output, this macro actually replaces the block of text with the image > with id 123. (While editing, the editor doesn't actually see the image, they > only see the macro) > > If you're on Heroku, or designing for Scale, you have some special > considerations when creating a web app that accepts large file uploads. Check > out this article here which explains how it is done: > https://devcenter.heroku.com/articles/paperclip-s3 > > In particular, see the note on this page that says: > > Large files uploads in single-threaded, non-evented environments (such as > Rails) block your application's web dynos and can cause request timeouts and > H11, H12 errors. For files larger than 4mb the direct upload method should be > used instead. > > In particular, if your images files are large (they say larger than 4 MB, but > I would even say larger than 500K), you need to do direct upload to S3. This > is documented here > https://devcenter.heroku.com/articles/direct-to-s3-image-uploads-in-rails > > As you can see, this is actually a complicated can of worms (which is why you > should strongly consider if option #1 above is better for you since it is > much easier and quicker to implement) > > You could probably write an uploader using method #2 described above that > works with TinyMCE and inserts some kind of high-level macro or the actual > image tag using javascript. But you definitely would have to get your hands > dirty with javascript. > > If you want to go with Method #2, I strongly recommend that you DO NOT do > pass-through uploading on Heroku. Although it will work for very small > files, at scale you will create long running-request bottlenecks that will > affect other users of your app -- people who aren't even using the upload > tool will see slow performance. The s3_direct_upload gem (below) is one > solution to this problem (it is an implementation of what the Heroku article > discusses when it says "Direct upload") > > see: > > http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and > > https://github.com/waynehoover/s3_direct_upload > > > > > > > On Aug 25, 2014, at 2:30 PM, Frank R. <[email protected]> wrote: > >> Does tinymce-rails have an image upload built-in? >> If now, what other gem is needed to do this? > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/8B526A09-F2D2-4397-B4D8-99F199857896%40datatravels.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D0C6499D-147E-46FA-AB7E-B2D28014BF95%40datatravels.com. For more options, visit https://groups.google.com/d/optout.

