2013-02-23 71 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"