【发布时间】:2011-02-12 23:31:17
【问题描述】:
我已经在我的 Windows 7 64 位上安装了 ImageMagick,并且我有 Paperclip Gem。我的用户模型如下所示:
class User < ActiveRecord::Base
# Paperclip
has_attached_file :photo,
:styles => {
:thumb=> "100x100#",
:small => "150x150>" }
end
在 paperclip.rb 和 development.rb 我有:
Paperclip.options[:command_path] = 'C:/Program Files/ImageMagick-6.6.7-Q16'
我的 _form 如下所示:
<%= form_for(@user, :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 :username %><br />
<%= f.text_field :username %>
</div>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :crypted_password %><br />
<%= f.text_field :crypted_password %>
</div>
<div class="field">
<%= f.label :password_salt %><br />
<%= f.text_field :password_salt %>
</div>
<%= f.file_field :photo%>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
enter code here
上传图片时出现以下错误:
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: C:/Users/John/AppData/Local/Temp/stream20110212-6576-1us1cdl.png is not recognized by the 'identify' command.>
我可以在我的 cmd 中对该图像使用 identify,它会毫无问题地返回有关图像的元数据。
如果可以,请提供帮助。我已经在这个问题上停留了一天多。
【问题讨论】:
标签: ruby-on-rails-3 imagemagick paperclip