【问题标题】:ckeditor-rails and paperclip not working correctlyckeditor-rails 和回形针无法正常工作
【发布时间】:2013-02-09 05:55:38
【问题描述】:

我正在使用 CKEditor-rails (https://github.com/tsechingho/ckeditor-rails),但在上传图片时遇到了一些问题。上传照片的模型如下:

class Ckeditor::Picture < Ckeditor::Asset
  has_attached_file :data,
                    :styles => { :content => '800>', :thumb => '118x100#' },
                    :s3_credentials => "#{Rails.root}/config/s3.yml",
                    :bucket => "********"

  validates_attachment_size :data, :less_than => 2.megabytes
  validates_attachment_presence :data

  def url_content
    url(:content)
  end
end

我使用CKEditor上传图片时,图片的URL是路径,格式为“/system//pictures/data/000/000/016 /content/**.jpg”。

似乎连图片都没有上传。

【问题讨论】:

    标签: ruby-on-rails amazon-s3 ckeditor paperclip


    【解决方案1】:

    我在我的模型中使用了这个设置,试试这个。

    has_attached_file :logo, :styles => { :orig => "300x400>",
                            :thumb => {:geometry => "80x58#", :format => :png},
                            :full => {:geometry => "#{SEARCH_IMAGE_WIDTH}x#{SEARCH_IMAGE_HEIGHT}#", :format => :png, :jcrop => true},
                            :cropped => {:geometry => "#{LOGO_WIDTH}x#{LOGO_HEIGHT}>", :jcrop => true, :format => :png} },
                            :storage => :s3,
                            :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
                            :path => "logos/:id/:style/:basename.:extension",
                            :bucket => "photo/#{Rails.env}/system"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-07
      • 1970-01-01
      • 1970-01-01
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多