2015-12-16 64 views
1

我在使用回形針GEM時出現以下錯誤。我嘗試上傳JPG/PNG,但都不起作用。這似乎是我得到驗證錯誤..任何幫助將是真棒謝謝!圖像包含的內容不是它們報告的內容

Image has contents that are not what they are reported to be 

class Listing < ActiveRecord::Base 
    has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "404.jpg" 
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ 
end 

回答

1

如果您正在使用Windows 7開發模式。你需要手動安裝file.exe並設置路徑。請按照鏈接 installing file.exe manually中的內容進行操作。

安裝後

環境

  1. 打開config/environments/development.rb
  2. 添加以下行:Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
  3. 重新啓動你的Rails服務器
0

這個工作對Windows 8的:

1.Download file.exe

2.測試,如果通過運行CMD你,把下面的說明以及安裝
轉換標誌:logo.miff然後運行imdisplay logo.miff

你將獲得自定義徽標圖像,這將在您的Windows屏幕上彈出。 從這裏,現在你可以開始配置on Rails應用程序的一切

打開配置/環境/ development.rb

添加以下行:Paperclip.options [:command_path] =「C:\工具\的GnuWin32 \ bin' 如果您的Rails服務器當前正在運行,請制動服務器,然後再次運行rails s.After後,您應該準備好去上傳您的應用程序中的圖像。