所见即所得的图像上传在Rails应用程序 [英] WYSIWYG image uploads in Rails App

查看:147
本文介绍了所见即所得的图像上传在Rails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以推荐一种创建视图的方式,用户可以通过所见即所得的编辑器将图像上传到我的应用程序?



我试着用CK Editor解决这个问题,回形针,但我有很多麻烦...也许我正在去这个错误的方式。

如果有人在这之前,我真的想知道怎么做!我没有一个编辑器或文件存储机制的偏好,所以消失... ...

解决方案

这一切都依赖所见即所得的文件上传API。从那里开始,只需构建一个ImagesController来处理来自该API的请求,使用任何系统(Paperclip是好的)在内部处理这些文件,并且您应该很好。你不会找到一个即插即用的解决方案;你必须手动滚动它。



结果发现,通过更有针对性的Google搜索,您可以 找到预先存在的解决方案。 下面是TinyMCE和Rails的一个。然而,你可能会发现它不符合你的需求,在这种情况下,我不会惊讶地发现创建你自己的解决方案比你想象的要简单:)

Can anyone recommend a way of creating a view where users can upload images to my app through a WYSIWYG editor?

I've tried solving this using CK Editor and Paperclip but am having lots of trouble... Maybe I'm going about this the wrong way.

If someone's done this before I'd really like to know how! I don't have a editor or file storage mechanism preference so fire away...

解决方案

This is all dependent on the WYSIWYG's file upload API. From there, just build an ImagesController to handle requests from that API, use whatever system (Paperclip is good) to handle those files internally, and you should be good to go. You won't find a plug-and-play solution; you'll have to hand-roll it.

Turns out that, with more targeted Google searching, you can find a preexisting solution. Here's one for TinyMCE and Rails. You may, however, end up finding that it doesn't meet your needs, in which case I would not be surprised to find that creating your own solution would be simpler than you expect :)

这篇关于所见即所得的图像上传在Rails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆