westman2222
westman2222

Reputation: 683

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

I am getting the following error while using the paperclip GEM.I have tried uploading JPG/PNG and neither works. It seems like I am getting validation error..any help would be awesome thanks!

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

Upvotes: 2

Views: 3019

Answers (2)

Hunter
Hunter

Reputation: 3362

This worked for Windows 8:

1.Download file.exe

2.Test if is well installed by running your cmd and put the following instructions
convert logo: logo.miff then run imdisplay logo.miff

You will get custom logo image,that will pop up on your windows screen. From here now you can start configuring everything on rails app

Open config/environments/development.rb

Add the following line: Paperclip.options[:command_path] = 'C:\tools\GnuWin32\bin' If your rails server is currently running,brake the server and then run again rails s.After that you should be ready to go.Upload image on your app.

Upvotes: 0

arun kumar
arun kumar

Reputation: 40

If your are using in windows 7 development mode. U need to manually install file.exe and set the path. Please follow the content in the link installing file.exe manually.

After installing

Environment

  1. Open config/environments/development.rb
  2. Add the following line: Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
  3. Restart your Rails server

Upvotes: 1

Related Questions