2013-02-23 72 views
1

我正在使用CKEditor-导轨(https://github.com/tsechingho/ckeditor-rails),我在上传图像时遇到了一些问题。上传照片的模式是这样的:ckeditor-导轨和回形针不能正常工作

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是“/系统的格式的路径/ /图片/数据/ 000/000/016/content/ **。jpg“。

它没有出现图像甚至被上传。

回答

0

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

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"