Cyber
Cyber

Reputation: 5000

Paperclip error when trying to upload Image

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.....

Upvotes: 1

Views: 189

Answers (2)

maximus ツ
maximus ツ

Reputation: 8065

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

Upvotes: 1

rorra
rorra

Reputation: 9693

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.

Upvotes: 1

Related Questions