1

I am using paperclip version 3.x.x for uploading image .When i tried to upload image i am getting 2 error,

Avatar C:/Users/ABC~1/AppData/Local/Temp/PNG_transparency_demonstration_120121214-6968-3t461n.png is not recognized by the 'identify' command.
Avatar C:/Users/ABC~1/AppData/Local/Temp/PNG_transparency_demonstration_120121214-6968-3t461n.png is not recognized by the 'identify' command.

My model,

class User < ActiveRecord::Base
      attr_accessible :name , :avatar
      has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
    end

View

<%= form_for @user , :url => users_path, :html => { :multipart => true } do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div>
    <%= f.file_field :avatar %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

I am using ImageMagic for processing image.... Is there anything i have to set in my Environment file.

Thanks in advance.....

Cyber
  • 4,844
  • 8
  • 41
  • 61
  • Did you try the answer in this [question](http://stackoverflow.com/questions/1996102/rails-paperclip-and-passenger-is-not-recognized-by-the-identify-command)? – cbascom Dec 14 '12 at 06:16
  • I am using windows 7 ,i set the path to Paperclip.options[:command_path] = "C:\ImageMagick-6.8.0-Q16" ,i am still getting the same error . – Cyber Dec 14 '12 at 06:21
  • If you replace the \ in that path with a / instead, does that make a difference? – cbascom Dec 14 '12 at 06:31
  • i tried that too.....but no change, same error....... – Cyber Dec 14 '12 at 06:38

2 Answers2

1

Paperclip behind the scene use ImageMagick to process the images. You can use ImageMagick with the command identify.

First check that you have installed ImageMagick.

Second, check that you can process the files (.png, .gif, etc.) with the identify command from the command line. ImageMagick need to be installed/compiled with support for the different image formats.

Third, setup Paperclip to tell it where it can find the ImageMagick identify command, it depends on where you installed ImageMagick, but you can setup it on a initializer (like /config/initializers/paperclip.rb) and put a content like

Paperclip.options[:command_path] = 'C:/Progra~1/ImageM~1.8-q'

But make sure that it points to the place where you have the identify command and ImageMagick installed.

rorra
  • 9,593
  • 3
  • 39
  • 61
1

Probably it is due to the cocaine and ImageMagicK, Try rolling back to previous version (0.3.2).

Here is the more explanation,

https://github.com/thoughtbot/paperclip/issues/1038

maximus ツ
  • 7,949
  • 3
  • 25
  • 54