您如何确切地将ckeditor与Paperclip集成,以便它可以上传图像文件? [英] How exactly DO you integrate ckeditor with Paperclip so it can upload image files?

查看:125
本文介绍了您如何确切地将ckeditor与Paperclip集成,以便它可以上传图像文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得 http://github.com/galetahub/rails-ckeditor 工作,所以你可以上传图像文件?我不认为我会使用s3存储...

How do you get http://github.com/galetahub/rails-ckeditor working so you can upload image files? I don't think I'll use the s3 storage...

任何帮助将不胜感激。

推荐答案

是的,可以。我假设你已经为S3设置了回形针。因此,您只需编辑模型目录(app / model / ckeditor /)中的picture.rb和attachement_file.rb并替换这些行。

Yes you can. I assume that you have paperclip already set up for S3. So you have only edit the picture.rb and attachement_file.rb in you model directory (app/model/ckeditor/) and replace these lines

  has_attached_file :data,
                    :url => "/ckeditor_assets/attachments/:id/:filename",
                    :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"

您的papeclip版本has_attached_file :

with your papeclip version has_attached_file:

  has_attached_file :data, :styles => { :content => '575>', :thumb => '80x80#' },
    :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => ":attachment/:id/:style.:extension",
    :url => ":s3_domain_url"

就是这样。 Btw:这是Rails 3的示例。

That's it. Btw: this is example from Rails 3.

这篇关于您如何确切地将ckeditor与Paperclip集成,以便它可以上传图像文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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